// SnapshotT calls Snapshotter.SnapshotT with the global config.
491295
func SnapshotT(t TestingT, i ...interface{}) {
	t.Helper()
	Global.SnapshotT(t, i...)
}
767656
func (m *CountMeter) Snapshot() metrics.Meter {
	m.mtx.RLock()
	defer m.mtx.RUnlock()
	return &MeterSnapshot{
		m.overall,
		m.rate1(),
		m.rate5(),
		m.rate15(),
		m.rateMean(),
	}
}
796098
func (f *FSM) Snapshot() (raft.FSMSnapshot, error) {
	f.mu.Lock()

	entries := make(map[SnapshotKey]SnapshotEntry)
	for _, group := range f.groups {
		for key, entry := range group {
			entries[SnapshotKey{
				Namespace: key.Namespace,
				ModelUUID: key.ModelUUID,
				Lease:     key.Lease,
			}] = SnapshotEntry{
				Holder:   entry.holder,
				Start:    entry.start,
				Duration: entry.duration,
			}
		}
	}

	pinned := make(map[SnapshotKey][]string)
	for key, entities := range f.pinned {
		if entities.IsEmpty() {
			continue
		}
		pinned[SnapshotKey{
			Namespace: key.Namespace,
			ModelUUID: key.ModelUUID,
			Lease:     key.Lease,
		}] = entities.SortedValues()
	}

	f.mu.Unlock()

	return &Snapshot{
		Version:    SnapshotVersion,
		Entries:    entries,
		Pinned:     pinned,
		GlobalTime: f.globalTime,
	}, nil
}
1209992
func Snapshot(name string, opts *SnapshotOpts) error {
	cmd := newCmd("snapshot")
	if opts != nil {
		cmd = addOpt(cmd, opts.Recurse, "-r")
		cmd = addProperties(cmd, opts.SetProperties)
	}
	cmd = addNonEmpty(cmd, name)
	return zExecNoOut(cmd)
}
316303
func (c *Client) SnapshotService(snapshotterName string) snapshots.Snapshotter {
	if c.snapshotters != nil {
		return c.snapshotters[snapshotterName]
	}
	c.connMu.Lock()
	defer c.connMu.Unlock()
	return snproxy.NewSnapshotter(snapshotsapi.NewSnapshotsClient(c.conn), snapshotterName)
}
1291336
func (s *StateStore) Snapshot() (*StateSnapshot, error) {
	snap := &StateSnapshot{
		StateStore: StateStore{
			logger: s.logger,
			config: s.config,
			db:     s.db.Snapshot(),
		},
	}
	return snap, nil
}
819490
func GetSnapshot(name string) (*Snapshot, error) {
	if !SnapshotExists(name) {
		return nil, fmt.Errorf("Snapshot not found")
	}
	return &Snapshot{
		Name: name,
	}, nil
}
389233
func (r *Registry) Snapshot() map[string]interface{} {
	r.m.Lock()
	defer r.m.Unlock()
	instruments := r.instruments
	r.instruments = make(map[string]interface{})
	return instruments
}
457997
func (s *ReplicationGroup) SetSnapshotWindow(v string) *ReplicationGroup {
	s.SnapshotWindow = &v
	return s
}
1322323
func (client *Client) CreateSnapshot(args *CreateSnapshotArgs) (snapshotId string, err error) {

	response := CreateSnapshotResponse{}

	err = client.Invoke("CreateSnapshot", args, &response)
	if err == nil {
		snapshotId = response.SnapshotId
	}
	return snapshotId, err
}
325447
func (_m *DFS) Snapshot(info dfs.SnapshotInfo, spaceFactor int) (string, error) {
	ret := _m.Called(info)

	var r0 string
	if rf, ok := ret.Get(0).(func(dfs.SnapshotInfo) string); ok {
		r0 = rf(info)
	} else {
		r0 = ret.Get(0).(string)
	}

	var r1 error
	if rf, ok := ret.Get(1).(func(dfs.SnapshotInfo) error); ok {
		r1 = rf(info)
	} else {
		r1 = ret.Error(1)
	}

	return r0, r1
}
398471
func (s *Simulation) UploadSnapshot(ctx context.Context, snapshotFile string, opts ...AddNodeOption) error {
	f, err := os.Open(snapshotFile)
	if err != nil {
		return err
	}

	jsonbyte, err := ioutil.ReadAll(f)
	f.Close()
	if err != nil {
		return err
	}
	var snap simulations.Snapshot
	if err := json.Unmarshal(jsonbyte, &snap); err != nil {
		return err
	}

	//the snapshot probably has the property EnableMsgEvents not set
	//set it to true (we need this to wait for messages before uploading)
	for i := range snap.Nodes {
		snap.Nodes[i].Node.Config.EnableMsgEvents = true
		snap.Nodes[i].Node.Config.Services = s.serviceNames
		for _, o := range opts {
			o(snap.Nodes[i].Node.Config)
		}
	}

	if err := s.Net.Load(&snap); err != nil {
		return err
	}
	return s.WaitTillSnapshotRecreated(ctx, &snap)
}
106426
func (s *Server) SnapshotRPC(args *structs.SnapshotRequest, in io.Reader, out io.Writer,
	replyFn structs.SnapshotReplyFn) error {

	// Perform the operation.
	var reply structs.SnapshotResponse
	snap, err := s.dispatchSnapshotRequest(args, in, &reply)
	if err != nil {
		return err
	}
	defer func() {
		if err := snap.Close(); err != nil {
			s.logger.Printf("[ERR] consul: Failed to close snapshot: %v", err)
		}
	}()

	// Let the caller peek at the reply.
	if replyFn != nil {
		if err := replyFn(&reply); err != nil {
			return nil
		}
	}

	// Stream the snapshot.
	if out != nil {
		if _, err := io.Copy(out, snap); err != nil {
			return fmt.Errorf("failed to stream snapshot: %v", err)
		}
	}
	return nil
}
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)
}
108567
func (c *Client) SnapshotGet(repository string) *SnapshotGetService {
	return NewSnapshotGetService(c).Repository(repository)
}
543130
func (s *VolumeServer) SnapshotCreate(
	ctx context.Context,
	req *api.SdkVolumeSnapshotCreateRequest,
) (*api.SdkVolumeSnapshotCreateResponse, error) {
	if s.cluster() == nil || s.driver(ctx) == nil {
		return nil, status.Error(codes.Unavailable, "Resource has not been initialized")
	}

	if len(req.GetVolumeId()) == 0 {
		return nil, status.Error(codes.InvalidArgument, "Must supply volume id")
	} else if len(req.GetName()) == 0 {
		return nil, status.Error(codes.InvalidArgument, "Must supply a name")
	}

	// Get access rights
	if err := s.checkAccessForVolumeId(ctx, req.GetVolumeId(), api.Ownership_Read); err != nil {
		return nil, err
	}

	readonly := true
	snapshotID, err := s.driver(ctx).Snapshot(req.GetVolumeId(), readonly, &api.VolumeLocator{
		Name:         req.GetName(),
		VolumeLabels: req.GetLabels(),
	}, false)
	if err != nil {
		if err == kvdb.ErrNotFound {
			return nil, status.Errorf(
				codes.NotFound,
				"Id %s not found",
				req.GetVolumeId())
		}
		return nil, status.Errorf(codes.Internal, "Failed to create snapshot: %v", err.Error())
	}

	return &api.SdkVolumeSnapshotCreateResponse{
		SnapshotId: snapshotID,
	}, nil
}
293553
func (s *ModifyClusterSnapshotOutput) SetSnapshot(v *Snapshot) *ModifyClusterSnapshotOutput {
	s.Snapshot = v
	return s
}