Documentation
¶
Index ¶
Constants ¶
const ( EventingAdminService = "eventingAdminPort" EventingAdminSSL = "eventingSSL" DataService = "kv" DataServiceSSL = "kvSSL" MgmtService = "mgmt" MgmtServiceSSL = "mgmtSSL" )
const ( EncryptionLevel = string("encryption level changed") CertificateChange = string("certificate changed") TLSConfigChange = string("tls config changed") )
Filter for tls changes This can't be used in interested event Client filter it out based on their needs
const ( // EventKVTopologyChanges represents subscriber is interested in Eventing // topology changes EventKVTopologyChanges eventType = iota // Node // EventQueryTopologyChanges represents subscriber is interested in Query // topology changes EventQueryTopologyChanges // Node // EventEventingTopologyChanges represents subscriber is interested in Eventing // topology changes EventEventingTopologyChanges // Node // EventVbmapChanges represents subscriber is interested in vb map // changes. Filter should be provided when vb map for a particular bucket. // empty filter means changes to all the bucket EventVbmapChanges // *VBmap // EventBucketList represents subscriber is interested in bucket list changes EventBucketListChanges // map[string]string // EventBucketChanges represents subscriber is interested in bucket given in filter changes. // filter should be provided when bucket changes need to be observed for particular EventBucketChanges // Buckets // EventScopeOrCollectionChanges represents subscriber is interested in collection manifest id changes // Filter should be provided when collection manifest changes to be observe for particular // bucket. Empty means changes to all bucket EventScopeOrCollectionChanges // CollectionManifest // EventClusterCompatibilityChanges represents subscriber is interested in cluster compatibility // changes EventClusterCompatibilityChanges // ClusterCompatibility // EventTLSChanges represents subscriber is interested in changes in tls settings EventTLSChanges )
const ( // EventChangeAdded represents something added to the respective eventType EventChangeAdded transition = iota // EventChangeRemoved represents something is removed from the respective eventType EventChangeRemoved // EventTransition represents something is moved EventTransition )
const (
// NOT_OWNED is used to indicate that the vbucket is not owned by any node
NOT_OWNED = -1
)
const (
NodeStatusHealthy = "healthy"
)
Variables ¶
var ( ErrFilterNotFound = errors.New("filter not present") ErrInvalidSubscriber = errors.New("not subscriber object") )
var (
ErrBucketDeleted = errors.New("Bucket doesn't exist")
)
Functions ¶
This section is empty.
Types ¶
type Bucket ¶
type Bucket struct {
Name string `json:"name"`
BucketType string `json:"bucketType"`
UUID string `json:"uuid"`
StorageBackend string `json:"storageBackend"`
NumVbucket int `json:"numVBuckets"`
}
Bucket represents a bucket in the cluster
func DiffBuckets ¶
DiffBuckets returns buckets which are present in A but not in B based on bucket UUID
type ClientTlsConfig ¶
type ClientTlsConfig struct {
// UseClientCert is true when N2N encryption is all/strict and client auth type is hybrid/mandatory
UseClientCert bool
ClientCertificate *tls.Certificate
ClientPrivateKeyPassphrase string
}
type Collection ¶
type Collection struct {
CID string
}
Collection represents the collection details
func (*Collection) Copy ¶
func (collection *Collection) Copy() *Collection
Copy will deep copy the Collection struct
func (*Collection) String ¶
func (c *Collection) String() string
type CollectionManifest ¶
CollectionManifest represents the collection manifest
func DiffCollectionManifest ¶
func DiffCollectionManifest(A *CollectionManifest, B *CollectionManifest) *CollectionManifest
DiffCollectionManifest returns collections which are in A but not in B. Uid field contains of As. This will also take care of recreated scope/collections in A
func (*CollectionManifest) Copy ¶
func (manifest *CollectionManifest) Copy() *CollectionManifest
Copy will deep copy the CollectionManifest struct
func (*CollectionManifest) String ¶
func (cm *CollectionManifest) String() string
type InterestedEvent ¶
type InterestedEvent struct {
// Event specifies which event type to be subscribed
Event eventType
// Filter specifies additional filtering of events
// For those event type where filtering is not allowed Register will return error
Filter string
}
InterestedEvent is passed to Subscriber for listening changes for events This will be returned in the WaitForEvent to differentiate between different events
func (InterestedEvent) String ¶
func (i InterestedEvent) String() string
type Node ¶
type Node struct {
ThisNode bool
Status string
NodeUUID string
ClusterCompatibility *Version
// Services provides the services to port mapping
Services map[string]int
// Contains the dns/ip address
HostName string
ExternalHostName string
NodeEncryption bool
}
Node specifies details of the node
type NodeAddress ¶
func (*NodeAddress) String ¶
func (na *NodeAddress) String() string
type Observer ¶
type Observer interface {
// GetSubscriberObject returns a empty subscriber interface
GetSubscriberObject() Subscriber
// RegisterForEvents subscribes for receiving changes for interestedEvent
// It can be called multiple times to register for different events
// It will return Current state of the interested event
RegisterForEvents(Subscriber, InterestedEvent) (interface{}, error)
// DeregisterEvent removes InterestedEvent from Subscriber
// These events won't be given in WaitForEvent once this function completes
DeregisterEvent(Subscriber, InterestedEvent)
// GetCurrentState returns the current state of the InterestedEvent
// returns error if InterestEvent doesn't exist
GetCurrentState(InterestedEvent) (interface{}, error)
// Block till we sync with the ns_server
WaitForConnect(ctx context.Context)
}
func NewObserver ¶
func NewObserver(settings *TLSClusterConfig, restAddress string, isIpv4 bool) (Observer, error)
NewObserver creates a new observer if not already created on default pool which can be used to create subscriber
func NewObserverForPool ¶
func NewObserverForPool(settings *TLSClusterConfig, poolName, restAddress string, isIpv4 bool) (Observer, error)
NewObserverForPool creates a new observer on a given pool which can be used to create subscriber
type Scope ¶
type Scope struct {
SID string
Collections map[string]*Collection
}
Scope represents scope details
type Subscriber ¶
type Subscriber interface {
// WaitForEvent is a blocking call. It will be blocked till
// some change event is called
// nil Transition event suggest no more event coming for this subscriber
// Its good practice to delete all the subscribed events when
// TransitionEvent is nil
WaitForEvent() <-chan *TransitionEvent
}
Subscriber is returned by Observer interface to wait for any changes it will return any changes in the cluster which it subscribed
type TLSClusterConfig ¶
type TlsConfig ¶
type TlsConfig struct {
Config *tls.Config
EncryptData bool
DisableNonSSLPorts bool
ClientTlsConfig
}
type TransitionEvent ¶
type TransitionEvent struct {
Event InterestedEvent
CurrentState interface{}
Transition map[transition]interface{}
// If filter is deleted then this will be set to true
Deleted bool
}
func (*TransitionEvent) String ¶
func (t *TransitionEvent) String() string
type VBmap ¶
type VBmap struct {
// ServerList represents kv node address
ServerList []NodeAddress
// VbToKv is the mapping of vb to active kvnode index
// kvNode address can be found out by ServerList
// If VbToKv doesn't contain vb then that vb isn't
// active on any kv node.
VbToKv map[uint16]int
}
VBmap represents vbucket to kv mapping
func DiffVBMap ¶
DiffVBMap returns VBmap in which ServerList is of A And VbToKv contains vb to kv index whose nodes got changed
func NewVbucketMap ¶
type Version ¶
Version represents version of the node
func VersionFromString ¶
Required string is evt-[shortversion]-[buildNumber]-[enterprise]