MCPcopy
hub / github.com/kopia/kopia / DirectWriteSession

Function DirectWriteSession

repo/repository.go:424–434  ·  view source on GitHub ↗

DirectWriteSession executes the provided callback in a DirectRepositoryWriter created for the purpose and flushes writes.

(ctx context.Context, r DirectRepository, opt WriteSessionOptions, cb func(ctx context.Context, dw DirectRepositoryWriter) error)

Source from the content-addressed store, hash-verified

422
423// DirectWriteSession executes the provided callback in a DirectRepositoryWriter created for the purpose and flushes writes.
424func DirectWriteSession(ctx context.Context, r DirectRepository, opt WriteSessionOptions, cb func(ctx context.Context, dw DirectRepositoryWriter) error) error {
425 ctx, span := tracer.Start(ctx, "DirectWriteSession:"+opt.Purpose)
426 defer span.End()
427
428 ctx, w, err := r.NewDirectWriter(ctx, opt)
429 if err != nil {
430 return errors.Wrap(err, "unable to create direct writer")
431 }
432
433 return handleWriteSessionResult(ctx, w, opt, cb(ctx, w))
434}
435
436// replaceManifestsHelper is a helper that deletes all manifests matching provided labels and replaces them with the provided one.
437func replaceManifestsHelper(ctx context.Context, rep RepositoryWriter, labels map[string]string, payload any) (manifest.ID, error) {

Callers 9

maybeRunMaintenanceMethod · 0.92
runMaintenanceTaskMethod · 0.92
TestServerMaintenanceFunction · 0.92
SessionMethod · 0.92
TestContentRewriteMethod · 0.92

Calls 3

handleWriteSessionResultFunction · 0.85
StartMethod · 0.65
NewDirectWriterMethod · 0.65