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

Method commitWithConstraint

db/journal/store.go:345–356  ·  view source on GitHub ↗
(ctx context.Context, key string, c Constraint, e Entry)

Source from the content-addressed store, hash-verified

343}
344
345func (s *Store) commitWithConstraint(ctx context.Context, key string, c Constraint, e Entry) error {
346 return s.commit(ctx, func() error {
347 oldEntry, ok := s.table[key]
348 if !ok {
349 return ErrNoSuchKey
350 }
351 if c != nil && !c(oldEntry) {
352 return ErrConstraint
353 }
354 return nil
355 }, e)
356}
357
358func (s *Store) commit(ctx context.Context, fn func() error, entries ...Entry) error {
359 serializer := bsupbytes.NewSerializer()

Callers 2

DeleteMethod · 0.95
UpdateMethod · 0.95

Calls 1

commitMethod · 0.95

Tested by

no test coverage detected