mirror of
https://github.com/gogrlx/nats-server.git
synced 2026-04-02 03:38:42 -07:00
Allow streams to be sealed through a stream update.
Sealed streams can not accept new messages, allow you to delete or purge messages, or have messages expire due to age. Sealed stream can not be unsealed through an update. Signed-off-by: Derek Collison <derek@nats.io>
This commit is contained in:
@@ -290,6 +290,9 @@ const (
|
||||
// JSStreamRestoreErrF restore failed: {err}
|
||||
JSStreamRestoreErrF ErrorIdentifier = 10062
|
||||
|
||||
// JSStreamSealedErr invalid operation on sealed stream
|
||||
JSStreamSealedErr ErrorIdentifier = 10109
|
||||
|
||||
// JSStreamSequenceNotMatchErr expected stream sequence does not match
|
||||
JSStreamSequenceNotMatchErr ErrorIdentifier = 10063
|
||||
|
||||
@@ -424,6 +427,7 @@ var (
|
||||
JSStreamReplicasNotSupportedErr: {Code: 500, ErrCode: 10074, Description: "replicas > 1 not supported in non-clustered mode"},
|
||||
JSStreamReplicasNotUpdatableErr: {Code: 400, ErrCode: 10061, Description: "Replicas configuration can not be updated"},
|
||||
JSStreamRestoreErrF: {Code: 500, ErrCode: 10062, Description: "restore failed: {err}"},
|
||||
JSStreamSealedErr: {Code: 400, ErrCode: 10109, Description: "invalid operation on sealed stream"},
|
||||
JSStreamSequenceNotMatchErr: {Code: 503, ErrCode: 10063, Description: "expected stream sequence does not match"},
|
||||
JSStreamSnapshotErrF: {Code: 500, ErrCode: 10064, Description: "snapshot failed: {err}"},
|
||||
JSStreamStoreFailedF: {Code: 503, ErrCode: 10077, Description: "{err}"},
|
||||
@@ -1543,6 +1547,16 @@ func NewJSStreamRestoreError(err error, opts ...ErrorOption) *ApiError {
|
||||
}
|
||||
}
|
||||
|
||||
// NewJSStreamSealedError creates a new JSStreamSealedErr error: "invalid operation on sealed stream"
|
||||
func NewJSStreamSealedError(opts ...ErrorOption) *ApiError {
|
||||
eopts := parseOpts(opts)
|
||||
if ae, ok := eopts.err.(*ApiError); ok {
|
||||
return ae
|
||||
}
|
||||
|
||||
return ApiErrors[JSStreamSealedErr]
|
||||
}
|
||||
|
||||
// NewJSStreamSequenceNotMatchError creates a new JSStreamSequenceNotMatchErr error: "expected stream sequence does not match"
|
||||
func NewJSStreamSequenceNotMatchError(opts ...ErrorOption) *ApiError {
|
||||
eopts := parseOpts(opts)
|
||||
|
||||
Reference in New Issue
Block a user