Example #1
0
// LoadLock loads and unserializes a lock from a repository.
func LoadLock(repo *repository.Repository, id backend.ID) (*Lock, error) {
	lock := &Lock{}
	if err := repo.LoadJSONUnpacked(backend.Lock, id, lock); err != nil {
		return nil, err
	}
	lock.lockID = &id

	return lock, nil
}
Example #2
0
func LoadSnapshot(repo *repository.Repository, id backend.ID) (*Snapshot, error) {
	sn := &Snapshot{id: id}
	err := repo.LoadJSONUnpacked(backend.Snapshot, id, sn)
	if err != nil {
		return nil, err
	}

	return sn, nil
}