// ApplySnapshot applies snapshot to local memory storage
779195
func (rs *RaftStorage) ApplySnapshot(snap raftpb.Snapshot) {
	if err := rs.ram.ApplySnapshot(snap); err != nil {
		if err == raft.ErrSnapOutOfDate {
			rs.lg.Warnf("Attempted to apply out-of-date snapshot at Term %d and Index %d",
				snap.Metadata.Term, snap.Metadata.Index)
		} else {
			rs.lg.Fatalf("Unexpected programming error: %s", err)
		}
	}
}
1207519
func (ds *Dataset) Snapshot(name string) (*Snapshot, error) {
	sn := fmt.Sprintf("%v@%v", ds.Name, name)
	err := exec.Command("zfs", "snapshot", sn).Run()
	if err != nil {
		return nil, err
	}
	return GetSnapshot(sn)
}
1113724
func (s *Store) Snapshot() *Store {
	if s.IsReadOnly() {
		return s
	}

	s.collLock.RLock()
	defer s.collLock.RUnlock()

	// Return a read-only Store with the new Collection set.
	snap := &Store{
		collLock:  nil,
		colls:     make(map[string]*Collection, len(s.colls)),
		collNames: s.collNames,
	}

	// Create a read-only Collection for each coll.
	for k, coll := range s.colls {
		newColl := &Collection{
			name: coll.name,
		}
		newColl.setRoot(coll.currentRoot())
		snap.colls[k] = newColl
	}
	return snap
}
163283
func (s *SnapshotGetService) Snapshot(snapshots ...string) *SnapshotGetService {
	s.snapshot = append(s.snapshot, snapshots...)
	return s
}
8285
func (opts *TransactionOptions) SetSetSnapshot(value bool) {
	C.rocksdb_transaction_options_set_set_snapshot(opts.c, boolToChar(value))
}
358606
func (a *api) AddSnapshot(cfg SnapshotConfig) (string, error) {
	client, err := a.connectDAO()
	if err != nil {
		return "", err
	}
	req := dao.SnapshotRequest{
		ServiceID:            cfg.ServiceID,
		Message:              cfg.Message,
		Tag:                  cfg.Tag,
		ContainerID:          cfg.DockerID,
		SnapshotSpacePercent: config.GetOptions().SnapshotSpacePercent,
	}
	var snapshotID string
	if err := client.Snapshot(req, &snapshotID); err != nil {
		return "", err
	}

	return snapshotID, nil
}
1305134
func (s *UniformSample) Snapshot() Sample {
	s.mutex.Lock()
	defer s.mutex.Unlock()
	values := make([]int64, len(s.values))
	copy(values, s.values)
	return &SampleSnapshot{
		count:  s.count,
		values: values,
	}
}
739906
func (s *InjectedStore) GetSnapshot(ver Version) (Snapshot, error) {
	snapshot, err := s.Storage.GetSnapshot(ver)
	return &InjectedSnapshot{
		Snapshot: snapshot,
		cfg:      s.cfg,
	}, err
}
819490
func GetSnapshot(name string) (*Snapshot, error) {
	if !SnapshotExists(name) {
		return nil, fmt.Errorf("Snapshot not found")
	}
	return &Snapshot{
		Name: name,
	}, nil
}
824417
func (tr *Repo) InitSnapshot() error {
	if tr.Root == nil {
		return ErrNotLoaded{Role: data.CanonicalRootRole}
	}
	root, err := tr.Root.ToSigned()
	if err != nil {
		return err
	}

	if _, ok := tr.Targets[data.CanonicalTargetsRole]; !ok {
		return ErrNotLoaded{Role: data.CanonicalTargetsRole}
	}
	targets, err := tr.Targets[data.CanonicalTargetsRole].ToSigned()
	if err != nil {
		return err
	}
	snapshot, err := data.NewSnapshot(root, targets)
	if err != nil {
		return err
	}
	tr.Snapshot = snapshot
	return nil
}
216601
func (rs *RaftStorage) Snapshot() raftpb.Snapshot {
	sn, _ := rs.ram.Snapshot() // Snapshot always returns nil error
	return sn
}
158961
func (lc *LightningChannel) StateSnapshot() *channeldb.ChannelSnapshot {
	lc.RLock()
	defer lc.RUnlock()

	return lc.channelState.Snapshot()
}
482564
func (c *Compactor) DisableSnapshots() {
	c.mu.Lock()
	c.snapshotsEnabled = false
	if c.snapshotsInterrupt != nil {
		close(c.snapshotsInterrupt)
		c.snapshotsInterrupt = nil
	}
	c.mu.Unlock()
}
122792
func (s *AuthorizeSnapshotAccessOutput) SetSnapshot(v *Snapshot) *AuthorizeSnapshotAccessOutput {
	s.Snapshot = v
	return s
}
188073
func (s *GetInstanceSnapshotOutput) SetInstanceSnapshot(v *InstanceSnapshot) *GetInstanceSnapshotOutput {
	s.InstanceSnapshot = v
	return s
}
97086
func (opts *ReadOptions) SetSnapshot(snap *Snapshot) {
	C.rocksdb_readoptions_set_snapshot(opts.c, snap.c)
}
612522
func (f *fragment) Snapshot() error {
	f.mu.Lock()
	defer f.mu.Unlock()
	return f.snapshot()
}