Documentation
¶
Index ¶
- func NewSnapshotter(cfg KvConfig) (*es.KeyValueSnapshotter, error)
- type AggCpStore
- type AggCpStoreConfig
- type Connector
- type CpStore
- type CpStoreConfig
- type EventStore
- func (e *EventStore) Append(ctx context.Context, aggType string, aggID string, expectedVersion es.Version, ...) (res *es.StoreAppendResult, err error)
- func (e *EventStore) Close() error
- func (e *EventStore) Load(ctx context.Context, aggType string, aggID string, opts ...es.StoreLoadOption) (loadedEvents []es.Envelope, err error)
- func (e *EventStore) Subscribe(ctx context.Context, opts ...es.SubscribeOption) (es.Subscription, error)
- type EventStoreConfig
- type KvConfig
- type KvStore
- type RetentionPolicy
- type Testing
- type Transport
- type TransportConfig
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func NewSnapshotter ¶
func NewSnapshotter(cfg KvConfig) (*es.KeyValueSnapshotter, error)
NewSnapshotter creates a new jetstream key-value-store based snapshotter.
Types ¶
type AggCpStore ¶
type AggCpStore struct {
// contains filtered or unexported fields
}
func NewAggCpStore ¶
func NewAggCpStore(cfg AggCpStoreConfig) (*AggCpStore, error)
type AggCpStoreConfig ¶
type Connector ¶
func ConnectDefault ¶
func ConnectDefault() Connector
func ConnectURL ¶
func NewTestContainer ¶
type CpStore ¶
type CpStore struct {
// contains filtered or unexported fields
}
func NewCpStore ¶
func NewCpStore(cfg CpStoreConfig) (*CpStore, error)
type CpStoreConfig ¶
type EventStore ¶
type EventStore struct {
// contains filtered or unexported fields
}
func NewEventStore ¶
func NewEventStore(cfg EventStoreConfig) (*EventStore, error)
func (*EventStore) Close ¶
func (e *EventStore) Close() error
func (*EventStore) Load ¶
func (e *EventStore) Load( ctx context.Context, aggType string, aggID string, opts ...es.StoreLoadOption, ) (loadedEvents []es.Envelope, err error)
func (*EventStore) Subscribe ¶
func (e *EventStore) Subscribe(ctx context.Context, opts ...es.SubscribeOption) (es.Subscription, error)
type EventStoreConfig ¶
type EventStoreConfig struct {
Connect Connector // Connect is used to create the underlying NATS connection. If nil, ConnectDefault() is used.
Log *slog.Logger // Log for diagnostics (optional)
SubjectPrefix string // SubjectPrefix is the prefix used to store events
StreamSubjects []string // StreamSubjects is the list of subjects the stream is fed with
StreamName string
RenameType func(string) string
// Retention defines the retention policy for the stream (default: RetentionLimits).
Retention RetentionPolicy
// MaxAge is the maximum age of messages in the stream.
MaxAge time.Duration
// MaxBytes is the maximum total size of messages in the stream.
MaxBytes int64
// MaxMsgs is the maximum number of messages in the stream.
MaxMsgs int64
}
type KvStore ¶
type KvStore struct {
// contains filtered or unexported fields
}
func NewKvStore ¶
type RetentionPolicy ¶
type RetentionPolicy int
RetentionPolicy defines how messages are retained in the stream.
const ( // RetentionLimits keeps messages until limits (MaxMsgs, MaxBytes, MaxAge) are reached. // This is the default NATS behavior - messages are kept until explicitly limited. RetentionLimits RetentionPolicy = iota // RetentionInterest keeps messages only while there are consumers with interest. // Messages are deleted once all interested consumers have acknowledged. RetentionInterest // RetentionWorkQueue makes each message available to only one consumer (queue semantics). // Messages are deleted after being consumed by any one consumer. RetentionWorkQueue )
type Transport ¶
type Transport struct {
// contains filtered or unexported fields
}
func NewTransport ¶
func NewTransport(cfg TransportConfig) (*Transport, error)
func (*Transport) SubscribeShard ¶
func (t *Transport) SubscribeShard(ctx context.Context, shardID uint32, h cluster.ServerHandlerFunc) (cluster.Subscription, error)
SubscribeShard subscribes to messages for a specific shard.
type TransportConfig ¶
Click to show internal directories.
Click to hide internal directories.