MCPcopy Index your code
hub / github.com/kopia/kopia / LoadSnapshot

Function LoadSnapshot

snapshot/manager.go:92–111  ·  view source on GitHub ↗

LoadSnapshot loads and parses a snapshot with a given ID.

(ctx context.Context, rep repo.Repository, manifestID manifest.ID)

Source from the content-addressed store, hash-verified

90
91// LoadSnapshot loads and parses a snapshot with a given ID.
92func LoadSnapshot(ctx context.Context, rep repo.Repository, manifestID manifest.ID) (*Manifest, error) {
93 sm := &Manifest{}
94
95 em, err := rep.GetManifest(ctx, manifestID, sm)
96 if err != nil {
97 if errors.Is(err, manifest.ErrNotFound) {
98 return nil, ErrSnapshotNotFound
99 }
100
101 return nil, errors.Wrap(err, "unable to find manifest entries")
102 }
103
104 if em.Labels[manifest.TypeLabelKey] != ManifestType {
105 return nil, errors.New("manifest is not a snapshot")
106 }
107
108 sm.ID = manifestID
109
110 return sm, nil
111}
112
113// SaveSnapshot persists given snapshot manifest and returns manifest ID.
114func SaveSnapshot(ctx context.Context, rep repo.RepositoryWriter, man *Manifest) (manifest.ID, error) {

Callers 7

runMethod · 0.92
runMethod · 0.92
mustReadManifestFunction · 0.92
handleEditSnapshotsFunction · 0.92
TestSnapshotsAPIFunction · 0.92
LoadSnapshotsFunction · 0.85

Calls 1

GetManifestMethod · 0.65

Tested by 2

mustReadManifestFunction · 0.74
TestSnapshotsAPIFunction · 0.74