MCPcopy Create free account
hub / github.com/brimdata/super / Get

Method Get

db/commits/store.go:65–85  ·  view source on GitHub ↗
(ctx context.Context, commit ksuid.KSUID)

Source from the content-addressed store, hash-verified

63}
64
65func (s *Store) Get(ctx context.Context, commit ksuid.KSUID) (*Object, error) {
66 if o, ok := s.cache.Get(commit); ok {
67 return o, nil
68 }
69 r, err := s.engine.Get(ctx, s.pathOf(commit))
70 if err != nil {
71 return nil, err
72 }
73 o, err := DecodeObject(r)
74 if err == ErrBadCommitObject {
75 err = fmt.Errorf("system error: %s: %w", s.pathOf(commit), ErrBadCommitObject)
76 }
77 if closeErr := r.Close(); err == nil {
78 err = closeErr
79 }
80 if err != nil {
81 return nil, err
82 }
83 s.cache.Add(commit, o)
84 return o, nil
85}
86
87func (s *Store) pathOf(commit ksuid.KSUID) *storage.URI {
88 return s.path.JoinPath(commit.String() + ".bsup")

Callers 5

buildSnapshotMethod · 0.95
PathRangeMethod · 0.95
PatchOfCommitMethod · 0.95
PatchOfPathMethod · 0.95
VacuumableMethod · 0.95

Calls 5

pathOfMethod · 0.95
DecodeObjectFunction · 0.85
GetMethod · 0.65
CloseMethod · 0.65
AddMethod · 0.45

Tested by

no test coverage detected