Documentation
¶
Index ¶
- Constants
- Variables
- func EnsureBucket(ctx context.Context, js jetstream.JetStream, cfg jetstream.KeyValueConfig, ...) error
- func EnsureBuckets(ctx context.Context, cfg *NatsConfig, js jetstream.JetStream, ...) error
- func EnsureConsumer(ctx context.Context, js jetstream.JetStream, streamName string, ...) error
- func EnsureStream(ctx context.Context, nc common.NatsConn, js jetstream.JetStream, ...) error
- func Nats(ctx context.Context, nc common.NatsConn, js jetstream.JetStream, ...) error
- func RequiresUpgrade(deployedVersion string, newVersion string) bool
- type NatsConfig
- type NatsConsumer
- type NatsKeyValue
- type NatsStream
Constants ¶
const Shar_version_field = "shar_version"
Shar_version_field is the version field name in the WORKFLOW stream metadata
Variables ¶
var UpgradeExpr = regexp.MustCompilePOSIX(`([0-9])*\.([0-9])*\.([0-9])*$`)
UpgradeExpr is the version check regex
Functions ¶
func EnsureBucket ¶ added in v1.1.754
func EnsureBucket(ctx context.Context, js jetstream.JetStream, cfg jetstream.KeyValueConfig, storageType jetstream.StorageType, namespaceBucketNameFn func(*jetstream.KeyValueConfig)) error
EnsureBucket creates a bucket if it does not exist
func EnsureBuckets ¶ added in v1.1.797
func EnsureBuckets(ctx context.Context, cfg *NatsConfig, js jetstream.JetStream, storageType jetstream.StorageType, ns string) error
EnsureBuckets creates a list of buckets if they do not exist
func EnsureConsumer ¶
func EnsureConsumer(ctx context.Context, js jetstream.JetStream, streamName string, consumerConfig jetstream.ConsumerConfig, update bool, storageType jetstream.StorageType) error
EnsureConsumer creates a new consumer appending the current semantic version number to the description. If the consumer exists and has a previous version, it upgrader it.
func EnsureStream ¶
func EnsureStream(ctx context.Context, nc common.NatsConn, js jetstream.JetStream, streamConfig jetstream.StreamConfig, storageType jetstream.StorageType) error
EnsureStream creates a new stream appending the current semantic version number to the description. If the stream exists and has a previous version, it upgrader it.
func Nats ¶
func Nats(ctx context.Context, nc common.NatsConn, js jetstream.JetStream, storageType jetstream.StorageType, config string, update bool, ns string) error
Nats sets up nats server objects.
func RequiresUpgrade ¶ added in v1.0.477
RequiresUpgrade reads the description on an existing SHAR JetStream object. It compares this with the running version and returs true if an upgrade is needed.
Types ¶
type NatsConfig ¶ added in v1.1.754
type NatsConfig struct {
Streams []NatsStream `json:"streams"`
KeyValue []NatsKeyValue `json:"buckets"`
}
NatsConfig is the SHAR NATS configuration format
type NatsConsumer ¶ added in v1.1.754
type NatsConsumer struct {
Config jetstream.ConsumerConfig `json:"nats-config"`
}
NatsConsumer holds information about a NATS Consumer
type NatsKeyValue ¶ added in v1.1.754
type NatsKeyValue struct {
Config jetstream.KeyValueConfig `json:"nats-config"`
}
NatsKeyValue holds information about a NATS Key-Value store (bucket)
type NatsStream ¶ added in v1.1.754
type NatsStream struct {
Config jetstream.StreamConfig `json:"nats-config"`
Consumers []NatsConsumer `json:"nats-consumers"`
}
NatsStream holds information about a NATS Stream