Documentation
¶
Index ¶
- Constants
- type AuthMethod
- type CustomAuthenticator
- type Hub
- func (h *Hub) CreateObjectStore(config ObjectStoreConfig) error
- func (h *Hub) CreateOrUpdateKeyValueStore(config KeyValueStoreConfig) error
- func (h *Hub) CreateOrUpdatePersistent(cfg *PersistentConfig) error
- func (h *Hub) DeleteFromKeyValueStore(bucket, key string) error
- func (h *Hub) DeleteFromObjectStore(bucket, key string) error
- func (h *Hub) GetFromKeyValueStore(bucket, key string) ([]byte, uint64, error)
- func (h *Hub) GetFromObjectStore(bucket, key string) ([]byte, error)
- func (h *Hub) PublishPersistent(subject string, msg []byte) error
- func (h *Hub) PublishVolatile(subject string, msg []byte) error
- func (h *Hub) PurgeKeyValueStore(bucket, key string) error
- func (h *Hub) PutToKeyValueStore(bucket, key string, value []byte) (uint64, error)
- func (h *Hub) PutToObjectStore(bucket, key string, data []byte, metadata map[string]string) error
- func (h *Hub) RequestVolatile(subject string, msg []byte, timeout time.Duration) ([]byte, error)
- func (h *Hub) Shutdown()
- func (h *Hub) SubscribePersistentViaDurable(subscriberID string, subject string, ...) (cancel func(), err error)
- func (h *Hub) SubscribePersistentViaEphemeral(subject string, ...) (cancel func(), err error)
- func (h *Hub) SubscribeVolatileViaFanout(subject string, handler func(subject string, msg []byte) ([]byte, bool), ...) (cancel func(), err error)
- func (h *Hub) SubscribeVolatileViaQueue(subject, queue string, handler func(subject string, msg []byte) ([]byte, bool), ...) (cancel func(), err error)
- func (h *Hub) UpdateToKeyValueStore(bucket, key string, value []byte, expectedRevision uint64) (uint64, error)
- type KeyValueStoreConfig
- type ObjectStoreConfig
- type Options
- type PersistentConfig
- type Size
- func (s Size) Bytes() int64
- func (s Size) Exabytes() float64
- func (s Size) Gigabytes() float64
- func (s Size) Kilobytes() float64
- func (s Size) MarshalText() ([]byte, error)
- func (s Size) Megabytes() float64
- func (s Size) Petabytes() float64
- func (s Size) String() string
- func (s Size) Terabytes() float64
- func (s *Size) UnmarshalText(text []byte) error
Constants ¶
View Source
const ( SizeBytes Size = 1 SizeKilobytes = 1024 * SizeBytes SizeMegabytes = 1024 * SizeKilobytes SizeGigabytes = 1024 * SizeMegabytes SizeTerabytes = 1024 * SizeGigabytes SizePetabytes = 1024 * SizeTerabytes SizeExabytes = 1024 * SizePetabytes )
View Source
const HubClusterName = "hubstream"
View Source
const HubIDFile = "hub.id"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type CustomAuthenticator ¶
type CustomAuthenticator struct {
// contains filtered or unexported fields
}
func NewCustomAuthenticator ¶
func NewCustomAuthenticator(authMethod AuthMethod) *CustomAuthenticator
func (*CustomAuthenticator) Check ¶
func (ca *CustomAuthenticator) Check(c server.ClientAuthentication) bool
type Hub ¶
type Hub struct {
// contains filtered or unexported fields
}
func (*Hub) CreateObjectStore ¶
func (h *Hub) CreateObjectStore(config ObjectStoreConfig) error
func (*Hub) CreateOrUpdateKeyValueStore ¶
func (h *Hub) CreateOrUpdateKeyValueStore(config KeyValueStoreConfig) error
func (*Hub) CreateOrUpdatePersistent ¶
func (h *Hub) CreateOrUpdatePersistent(cfg *PersistentConfig) error
func (*Hub) DeleteFromKeyValueStore ¶
func (*Hub) DeleteFromObjectStore ¶
func (*Hub) GetFromKeyValueStore ¶
func (*Hub) GetFromObjectStore ¶
func (*Hub) PurgeKeyValueStore ¶
func (*Hub) PutToKeyValueStore ¶
func (*Hub) PutToObjectStore ¶
func (*Hub) RequestVolatile ¶
func (*Hub) SubscribePersistentViaDurable ¶
func (*Hub) SubscribePersistentViaEphemeral ¶
func (*Hub) SubscribeVolatileViaFanout ¶
func (*Hub) SubscribeVolatileViaQueue ¶
type KeyValueStoreConfig ¶
type ObjectStoreConfig ¶
type ObjectStoreConfig struct {
Bucket string `json:"bucket"`
Description string `json:"description,omitempty"`
TTL time.Duration `json:"max_age,omitempty"`
MaxBytes Size `json:"max_bytes,omitempty"`
Replicas int `json:"num_replicas,omitempty"`
Metadata map[string]string `json:"metadata,omitempty"`
}
type Options ¶
type Options struct {
Name string
Host string
Port int
AuthorizationToken string
MaxPayload Size
Routes []*url.URL
ClusterHost string
ClusterPort int
ClusterUsername string
ClusterPassword string
ClusterConnPoolSize int
ClusterPingInterval time.Duration
GatewayHost string
GatewayPort int
GatewayUsername string
GatewayPassword string
GatewayRoutes []struct {
Name string
URL *url.URL
}
LeafNodeHost string
LeafNodePort int
LeafNodeUsername string
LeafNodePassword string
LeafNodeRoutes []*url.URL
JetstreamMaxMemory Size
JetstreamMaxStorage Size
StreamMaxBufferedMsgs int
StreamMaxBufferedSize int64
StoreDir string
SyncInterval time.Duration
SyncAlways bool
LogFile string
LogSizeLimit int64
LogMaxFiles int64
Syslog bool
RemoteSyslog string
ClientAuthenticationMethod AuthMethod
RouterAuthenticationMethod AuthMethod
}
func DefaultEdgeOptions ¶
func DefaultGatewayOptions ¶
func DefaultNodeOptions ¶
type PersistentConfig ¶
type PersistentConfig struct {
// Description is an optional description of the stream.
Description string
// Subjects is a list of subjects that the stream is listening on.
// Wildcards are supported. Subjects cannot be set if the stream is
// created as a mirror.
Subjects []string
// Retention defines the message retention policy for the stream.
// Defaults to LimitsPolicy.
Retention nats.RetentionPolicy
// MaxConsumers specifies the maximum number of consumers allowed for
// the stream.
MaxConsumers int
// MaxMsgs is the maximum number of messages the stream will store.
// After reaching the limit, stream adheres to the discard policy.
// If not set, server default is -1 (unlimited).
MaxMsgs int64
// MaxBytes is the maximum total size of messages the stream will store.
// After reaching the limit, stream adheres to the discard policy.
// If not set, server default is -1 (unlimited).
MaxBytes int64
// MaxAge is the maximum age of messages that the stream will retain.
MaxAge time.Duration
// MaxMsgsPerSubject is the maximum number of messages per subject that
// the stream will retain.
MaxMsgsPerSubject int64
// MaxMsgSize is the maximum size of any single message in the stream.
MaxMsgSize Size
// Replicas is the number of stream replicas in clustered JetStream.
// Defaults to 1, maximum is 5.
Replicas int
// NoAck is a flag to disable acknowledging messages received by this
// stream.
//
// If set to true, publish methods from the JetStream client will not
// work as expected, since they rely on acknowledgements. Core NATS
// publish methods should be used instead. Note that this will make
// message delivery less reliable.
NoAck bool
// Duplicates is the window within which to track duplicate messages.
// If not set, server default is 2 minutes.
Duplicates time.Duration
// Metadata is an optional set of key/value pairs that can be used to
// store additional information about the stream.
Metadata map[string]string
}
type Size ¶
type Size int64
func NewSizeFromBytes ¶
func NewSizeFromExabytes ¶
func NewSizeFromGigabytes ¶
func NewSizeFromKilobytes ¶
func NewSizeFromMegabytes ¶
func NewSizeFromPetabytes ¶
func NewSizeFromTerabytes ¶
func (Size) MarshalText ¶
func (*Size) UnmarshalText ¶
Click to show internal directories.
Click to hide internal directories.