2023-03-28 18:39:22 +00:00
|
|
|
// Copyright (c) HashiCorp, Inc.
|
2023-08-11 13:12:13 +00:00
|
|
|
// SPDX-License-Identifier: BUSL-1.1
|
2023-03-28 18:39:22 +00:00
|
|
|
|
2016-10-26 02:20:24 +00:00
|
|
|
package structs
|
|
|
|
|
|
|
|
type SnapshotOp int
|
|
|
|
|
|
|
|
const (
|
|
|
|
SnapshotSave SnapshotOp = iota
|
|
|
|
SnapshotRestore
|
|
|
|
)
|
|
|
|
|
2017-06-15 09:50:28 +00:00
|
|
|
// SnapshotReplyFn gets a peek at the reply before the snapshot streams, which
|
|
|
|
// is useful for setting headers.
|
|
|
|
type SnapshotReplyFn func(reply *SnapshotResponse) error
|
|
|
|
|
2016-10-26 02:20:24 +00:00
|
|
|
// SnapshotRequest is used as a header for a snapshot RPC request. This will
|
|
|
|
// precede any streaming data that's part of the request and is JSON-encoded on
|
|
|
|
// the wire.
|
|
|
|
type SnapshotRequest struct {
|
|
|
|
// Datacenter is the target datacenter for this request. The request
|
|
|
|
// will be forwarded if necessary.
|
|
|
|
Datacenter string
|
|
|
|
|
|
|
|
// Token is the ACL token to use for the operation. If ACLs are enabled
|
|
|
|
// then all operations require a management token.
|
|
|
|
Token string
|
|
|
|
|
|
|
|
// If set, any follower can service the request. Results may be
|
|
|
|
// arbitrarily stale. Only applies to SnapshotSave.
|
|
|
|
AllowStale bool
|
|
|
|
|
|
|
|
// Op is the operation code for the RPC.
|
|
|
|
Op SnapshotOp
|
|
|
|
}
|
|
|
|
|
|
|
|
// SnapshotResponse is used header for a snapshot RPC response. This will
|
|
|
|
// precede any streaming data that's part of the request and is JSON-encoded on
|
|
|
|
// the wire.
|
|
|
|
type SnapshotResponse struct {
|
|
|
|
// Error is the overall error status of the RPC request.
|
|
|
|
Error string
|
|
|
|
|
|
|
|
// QueryMeta has freshness information about the server that handled the
|
|
|
|
// request. It is only filled in for a SnapshotSave.
|
|
|
|
QueryMeta
|
|
|
|
}
|