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

Function Create

db/journal/queue.go:233–246  ·  view source on GitHub ↗
(ctx context.Context, engine storage.Engine, path *storage.URI, base ID)

Source from the content-addressed store, hash-verified

231}
232
233func Create(ctx context.Context, engine storage.Engine, path *storage.URI, base ID) (*Queue, error) {
234 q := New(engine, path)
235 if err := q.writeHead(ctx, Nil); err != nil {
236 return nil, err
237 }
238 // Tail is initialized with the first entry of the journal, which does
239 // not yet exist. The journal is empty iff HEAD == 0. Once written
240 // to the journal is never empty again, but it may be reset by higher
241 // layers by writing a NOP and moving TAIL to HEAD.
242 if err := q.writeTail(ctx, 1, base); err != nil {
243 return nil, err
244 }
245 return q, nil
246}
247
248func Open(ctx context.Context, engine storage.Engine, path *storage.URI) (*Queue, error) {
249 q := New(engine, path)

Callers 2

CreateStoreFunction · 0.70
newQueueFunction · 0.70

Calls 3

writeHeadMethod · 0.80
writeTailMethod · 0.80
NewFunction · 0.70

Tested by 1

newQueueFunction · 0.56