github.com/sl1pm4t/consul@v1.4.5-0.20190325224627-74c31c540f9c/agent/structs/snapshot.go (about)

     1  package structs
     2  
     3  type SnapshotOp int
     4  
     5  const (
     6  	SnapshotSave SnapshotOp = iota
     7  	SnapshotRestore
     8  )
     9  
    10  // SnapshotReplyFn gets a peek at the reply before the snapshot streams, which
    11  // is useful for setting headers.
    12  type SnapshotReplyFn func(reply *SnapshotResponse) error
    13  
    14  // SnapshotRequest is used as a header for a snapshot RPC request. This will
    15  // precede any streaming data that's part of the request and is JSON-encoded on
    16  // the wire.
    17  type SnapshotRequest struct {
    18  	// Datacenter is the target datacenter for this request. The request
    19  	// will be forwarded if necessary.
    20  	Datacenter string
    21  
    22  	// Token is the ACL token to use for the operation. If ACLs are enabled
    23  	// then all operations require a management token.
    24  	Token string
    25  
    26  	// If set, any follower can service the request. Results may be
    27  	// arbitrarily stale. Only applies to SnapshotSave.
    28  	AllowStale bool
    29  
    30  	// Op is the operation code for the RPC.
    31  	Op SnapshotOp
    32  }
    33  
    34  // SnapshotResponse is used header for a snapshot RPC response. This will
    35  // precede any streaming data that's part of the request and is JSON-encoded on
    36  // the wire.
    37  type SnapshotResponse struct {
    38  	// Error is the overall error status of the RPC request.
    39  	Error string
    40  
    41  	// QueryMeta has freshness information about the server that handled the
    42  	// request. It is only filled in for a SnapshotSave.
    43  	QueryMeta
    44  }