satellite/metainfo: improve Loop comments (#3595)
This commit is contained in:
parent
2739771761
commit
d96df2691a
@ -19,7 +19,7 @@ import (
|
|||||||
var (
|
var (
|
||||||
// LoopError is a standard error class for this component.
|
// LoopError is a standard error class for this component.
|
||||||
LoopError = errs.Class("metainfo loop error")
|
LoopError = errs.Class("metainfo loop error")
|
||||||
// LoopClosedError is a loop closed error
|
// LoopClosedError is a loop closed error.
|
||||||
LoopClosedError = LoopError.New("loop closed")
|
LoopClosedError = LoopError.New("loop closed")
|
||||||
)
|
)
|
||||||
|
|
||||||
@ -32,7 +32,7 @@ type Observer interface {
|
|||||||
InlineSegment(context.Context, ScopedPath, *pb.Pointer) error
|
InlineSegment(context.Context, ScopedPath, *pb.Pointer) error
|
||||||
}
|
}
|
||||||
|
|
||||||
// ScopedPath contains full expanded information about the path
|
// ScopedPath contains full expanded information about the path.
|
||||||
type ScopedPath struct {
|
type ScopedPath struct {
|
||||||
ProjectID uuid.UUID
|
ProjectID uuid.UUID
|
||||||
ProjectIDString string
|
ProjectIDString string
|
||||||
@ -169,7 +169,7 @@ waitformore:
|
|||||||
return iterateDatabase(ctx, loop.db, observers)
|
return iterateDatabase(ctx, loop.db, observers)
|
||||||
}
|
}
|
||||||
|
|
||||||
// IterateDatabase iterate over PointerDB and notify specified observers about results
|
// IterateDatabase iterates over PointerDB and notifies specified observers about results.
|
||||||
func IterateDatabase(ctx context.Context, db PointerDB, observers ...Observer) error {
|
func IterateDatabase(ctx context.Context, db PointerDB, observers ...Observer) error {
|
||||||
obsContexts := make([]*observerContext, len(observers))
|
obsContexts := make([]*observerContext, len(observers))
|
||||||
for i, observer := range observers {
|
for i, observer := range observers {
|
||||||
@ -183,7 +183,7 @@ func IterateDatabase(ctx context.Context, db PointerDB, observers ...Observer) e
|
|||||||
}
|
}
|
||||||
|
|
||||||
// handlePointer deals with a pointer for a single observer
|
// handlePointer deals with a pointer for a single observer
|
||||||
// if there is some error on the observer, handle the error and return false. Otherwise, return true
|
// if there is some error on the observer, handles the error and returns false. Otherwise, returns true.
|
||||||
func handlePointer(ctx context.Context, observer *observerContext, path ScopedPath, isLastSegment bool, pointer *pb.Pointer) bool {
|
func handlePointer(ctx context.Context, observer *observerContext, path ScopedPath, isLastSegment bool, pointer *pb.Pointer) bool {
|
||||||
switch pointer.GetType() {
|
switch pointer.GetType() {
|
||||||
case pb.Pointer_REMOTE:
|
case pb.Pointer_REMOTE:
|
||||||
|
Loading…
Reference in New Issue
Block a user