util

package
v0.0.0-...-31abfad Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Dec 16, 2024 License: Apache-2.0 Imports: 45 Imported by: 6

Documentation

Index

Constants

View Source
const (
	EVENTING_ADMIN_SERVICE = "eventingAdminPort"
	EVENTING_SSL_SERVICE   = "eventingSSL"
)
View Source
const (
	SYSTEM_EVENT_COMPONENT = "eventing"

	SUB_COMPONENT_EVENTING_PRODUCER = "eventing-producer"

	DEFAULT_TIMEOUT_SECS = 2
)
View Source
const (
	EVENTID_PRODUCER_STARTUP systemeventlog.EventId = 4096

	EVENTID_CONSUMER_STARTUP systemeventlog.EventId = 4097
	EVENTID_CONSUMER_CRASH   systemeventlog.EventId = 4098

	EVENTID_START_TRACING systemeventlog.EventId = 4099
	EVENTID_STOP_TRACING  systemeventlog.EventId = 4100

	EVENTID_START_DEBUGGER systemeventlog.EventId = 4101
	EVENTID_STOP_DEBUGGER  systemeventlog.EventId = 4102

	EVENTID_CREATE_FUNCTION   systemeventlog.EventId = 4103
	EVENTID_DELETE_FUNCTION   systemeventlog.EventId = 4104
	EVENTID_IMPORT_FUNCTIONS  systemeventlog.EventId = 4105
	EVENTID_EXPORT_FUNCTIONS  systemeventlog.EventId = 4106
	EVENTID_BACKUP_FUNCTION   systemeventlog.EventId = 4107
	EVENTID_RESTORE_FUNCTION  systemeventlog.EventId = 4108
	EVENTID_DEPLOY_FUNCTION   systemeventlog.EventId = 4109
	EVENTID_UNDEPLOY_FUNCTION systemeventlog.EventId = 4110
	EVENTID_PAUSE_FUNCTION    systemeventlog.EventId = 4111
	EVENTID_RESUME_FUNCTION   systemeventlog.EventId = 4112

	EVENTID_CLEANUP_EVENTING systemeventlog.EventId = 4113
	EVENTID_DIE              systemeventlog.EventId = 4114
	EVENTID_TRIGGER_GC       systemeventlog.EventId = 4115
	EVENTID_FREE_OS_MEMORY   systemeventlog.EventId = 4116

	EVENTID_UPDATE_CONFIG    systemeventlog.EventId = 4117
	EVENTID_CLEAR_STATISTICS systemeventlog.EventId = 4118
)
View Source
const (
	Stop time.Duration = -1

	DefaultInitialInterval     = 1 * time.Second
	DefaultRandomizationFactor = 0.5
	DefaultMultiplier          = 1.5
	DefaultMaxInterval         = 10 * time.Second
	DefaultMaxElapsedTime      = time.Minute
)
View Source
const (
	EventingAdminService = "eventingAdminPort"
	EventingAdminSSL     = "eventingSSL"
	DataService          = "kv"
	DataServiceSSL       = "kvSSL"
	MgmtService          = "mgmt"
	MgmtServiceSSL       = "mgmtSSL"

	EPSILON = 1e-5
)
View Source
const BUCKET_UUID_NIL = ""
View Source
const CLUSTER_INFO_INIT_RETRIES = 5
View Source
const CLUSTER_INFO_VALIDATION_RETRIES = 10
View Source
const CLUSTER_VERSION_7 uint32 = 7
View Source
const (
	MAX_AUTH_RETRIES = 10
)
View Source
const OBOAuthHeader = "cb-on-behalf-of"

Variables

View Source
var (
	ErrInvalidNodeId       = errors.New("Invalid NodeId")
	ErrInvalidService      = errors.New("Invalid service")
	ErrNodeNotBucketMember = errors.New("Node is not a member of bucket")
	ErrValidationFailed    = errors.New("ClusterInfo Validation Failed")
)
View Source
var (
	ErrNodeServicesConnect = errors.New("Internal services API connection closed")
	ErrNodeServicesCancel  = errors.New("Cancelled services change notifier")
	ErrNotifierInvalid     = errors.New("Notifier invalidated due to internal error")
)
View Source
var (
	CrcTable *crc32.Table
	TCP_REQ  = "required"
	TCP_OPT  = "optional"
	TCP_OFF  = "off"

	HTTPRequestTimeout = 10 * time.Second
)
View Source
var AppNotExist = errors.New("App content doesn't exist or is empty")
View Source
var DefaultClient = &Client{}
View Source
var ErrWildcardNotAllowed = errors.New("Wildcard not allowed")
View Source
var ErrorClosed = errors.New("bounded_queue is closed")
View Source
var ErrorSize = errors.New("element size is more than max memory quota")
View Source
var GocbCredsRequestCounter = 0
View Source
var ServiceAddrMap map[string]string
View Source
var SingletonServicesContainer struct {
	sync.Mutex
	Notifiers map[string]*serviceNotifierInstance
}

Implements nodeServices change notifier system

View Source
var SystemClock = systemClock{}

Functions

func AppendCredentials

func AppendCredentials(path, appLocation string, payload []byte) ([]byte, error)

func AppendLangCompat

func AppendLangCompat(path, appLocation string, payload []byte) ([]byte, error)

func Assert

func Assert(stmt func() bool)

func BreakpadOn

func BreakpadOn() bool

func BucketSeqnos

func BucketSeqnos(cluster, pooln, bucketn string) (l_seqnos []uint64, err error)

BucketSeqnos return list of {{vbno,seqno}..} for all vbuckets. this call might fail due to,

  • concurrent access that can preserve a deleted/failed bucket object.
  • pollForDeletedBuckets() did not get a chance to cleanup a deleted bucket.

in both the cases if the call is retried it should get fixed, provided a valid bucket exists.

func CPUCount

func CPUCount(log bool) int

func CheckAndGetBktAndScopeIDs

func CheckAndGetBktAndScopeIDs(fG *common.FunctionScope, restPort string) (string, uint32, error)

func CheckBucketExist

func CheckBucketExist(bucket, hostaddress string) bool

func CheckIfAppBootstrapOngoing

func CheckIfAppBootstrapOngoing(urlSuffix string, nodeAddrs []string, query string) (bool, error)

func CheckIfBootstrapOngoing

func CheckIfBootstrapOngoing(urlSuffix string, nodeAddrs []string) (bool, error)

func CheckIfRebalanceOngoing

func CheckIfRebalanceOngoing(urlSuffix string, nodeAddrs []string) (bool, error)

func CheckTLSandReplaceProtocol

func CheckTLSandReplaceProtocol(connStr string, args ...interface{}) string

func ClusterUrl

func ClusterUrl(cluster string) (string, error)

func CollectSeqnos

func CollectSeqnos(kvfeeds map[string]*kvConn, bucketLevel bool, cid uint32) (l_seqnos []uint64, err error)

func CollectionAware

func CollectionAware(hostaddress string) (bool, error)

func CompareSlices

func CompareSlices(s1, s2 []uint16) bool

func CompareStringSlices

func CompareStringSlices(s1, s2 []string) bool

func ComposeOBOAuthInfo

func ComposeOBOAuthInfo(user, domain string) (oboAuthInfo string)

func ComputeMD5

func ComputeMD5(data []byte) ([]byte, error)

func Condense

func Condense(vbs []uint16) string

func ConnectBucket

func ConnectBucket(cluster, pooln, bucketn string) (*couchbase.Bucket,
	uint32, error)

ConnectBucket will instantiate a couchbase-bucket instance with cluster. caller's responsibility to close the bucket. It also returns clusterVersion

func Console

func Console(clusterAddr string, format string, v ...interface{}) error

Write to the admin console

func Contains

func Contains(needle interface{}, haystack interface{}) bool

func ContainsIgnoreCase

func ContainsIgnoreCase(needle string, haystack []string) bool

func ConvertBigEndianToUint64

func ConvertBigEndianToUint64(cas []byte) (uint64, error)

func CountActiveKVNodes

func CountActiveKVNodes(bucket, hostaddress string) int

func CurrentEventingNodeAddress

func CurrentEventingNodeAddress(hostaddress string) (string, error)

func DeepCopy

func DeepCopy(kv map[string]interface{}) (newKv map[string]interface{})

func DeleteAppContent

func DeleteAppContent(appPath, checksumPath, appLocation string) error

DeleteAppContent delete handler code

func DeleteStaleAppContent

func DeleteStaleAppContent(appPath, appLocation string) error

Delete stale app fragments

func Do

func Do(req *http.Request) (*http.Response, error)

func EncodeAppPayload

func EncodeAppPayload(app *cm.Application) []byte

func EventingNodesAddresses

func EventingNodesAddresses(hostaddress string) ([]string, error)

func EventingVer

func EventingVer() string

func FloatEquals

func FloatEquals(a, b float64) bool

func GenerateFunctionID

func GenerateFunctionID() (uint32, error)

func GenerateFunctionInstanceID

func GenerateFunctionInstanceID() (string, error)

func GenerateRandomNameSuffix

func GenerateRandomNameSuffix() string

func Get

func Get(url string) (resp *http.Response, err error)

func GetAggBootstrapAppStatus

func GetAggBootstrapAppStatus(nodeAddr string, query string, isLocalhost bool) (bool, error)

func GetAggBootstrapStatus

func GetAggBootstrapStatus(nodeAddr string) (bool, error)

func GetAggBootstrappingApps

func GetAggBootstrappingApps(urlSuffix string, nodeAddrs []string) (bool, error)

func GetAggPausingApps

func GetAggPausingApps(urlSuffix string, nodeAddrs []string) (bool, error)

func GetAppNameFromPath

func GetAppNameFromPath(path string) (string, error)

func GetAppStatus

func GetAppStatus(urlSuffix string, nodeAddrs []string) (map[string]map[string]string, error)

func GetCluster

func GetCluster(caller, connstr string, s common.EventingSuperSup) (*gocb.Cluster, error)

func GetConnectionStr

func GetConnectionStr(kvVBMap map[uint16]string) string

func GetEventProcessingStats

func GetEventProcessingStats(urlSuffix string, nodeAddrs []string) (map[string]int64, error)

func GetEventingVersion

func GetEventingVersion(urlSuffix string, nodeAddrs []string) ([]string, error)

func GetFunctionInstanceId

func GetFunctionInstanceId(funcId uint32, funcInstanceId string) string

func GetHash

func GetHash(appCode string) string

func GetIPMode

func GetIPMode() string

func GetLogLevel

func GetLogLevel(logLevel string) logging.LogLevel

func GetNetworkProtocol

func GetNetworkProtocol() string

func GetNodeUUIDs

func GetNodeUUIDs(urlSuffix string, nodeAddrs []string) (map[string]string, error)

func GetProgress

func GetProgress(urlSuffix string, nodeAddrs []string) (*cm.RebalanceProgress, map[string]interface{}, map[string]error)

func GetRestPort

func GetRestPort() string

func GetSecurityConfig

func GetSecurityConfig() *common.SecuritySetting

func GetSeqnos

func GetSeqnos(args ...interface{}) error
func Head(url string) (resp *http.Response, err error)

func HexLittleEndianToUint64

func HexLittleEndianToUint64(hexLE []byte) (uint64, error)

func IgnorePurgeSeqFlagAvailable

func IgnorePurgeSeqFlagAvailable(hostaddress string) (bool, error)

func InitialiseSystemEventLogger

func InitialiseSystemEventLogger(restPort string)

func IsIPv6

func IsIPv6() bool

func KVNodesAddresses

func KVNodesAddresses(hostaddress, bucket string) ([]string, error)

func KVVbMap

func KVVbMap(bucket, hostaddress string) (map[uint16]string, error)

func KillProcess

func KillProcess(pid int) error

func ListChildren

func ListChildren(path string) ([]string, error)

func LocalEventingServiceHost

func LocalEventingServiceHost(hostaddress string) (string, error)

func LocalKey

func LocalKey() (usr, key string)

func Localhost

func Localhost() string

func LogSystemEvent

func LogSystemEvent(eventId systemeventlog.EventId,
	severity systemeventlog.EventSeverity, extraAttributes interface{})

func MaxFunctionSize

func MaxFunctionSize() int

func MaybeCompress

func MaybeCompress(payload []byte, compressPayload bool) ([]byte, error)

func MaybeDecompress

func MaybeDecompress(payload []byte) ([]byte, error)

func MemcachedErrCode

func MemcachedErrCode(err error) gomemcached.Status

func MetaKvDelete

func MetaKvDelete(path string, rev interface{}) error

func MetaKvMaxDocSize

func MetaKvMaxDocSize() int

func MetakvGet

func MetakvGet(path string) ([]byte, error)

func MetakvRecursiveDelete

func MetakvRecursiveDelete(dirpath string) error

func MetakvSet

func MetakvSet(path string, value []byte, rev interface{}) error

func MetakvSetSensitive

func MetakvSetSensitive(path string, value []byte, rev interface{}) error

func NewRequest

func NewRequest(method, url string, body io.Reader) (*http.Request, error)

func NsServerNodesAddresses

func NsServerNodesAddresses(hostaddress string) ([]string, error)

func ParseFunctionPayload

func ParseFunctionPayload(data []byte, fnName string) cm.Application

func Post

func Post(url string, contentType string, body io.Reader) (resp *http.Response, err error)

func PostForm

func PostForm(url string, data url.Values) (resp *http.Response, err error)

func ReadAppContent

func ReadAppContent(appsPath, checksumPath, appLocation string) ([]byte, error)

ReadAppContent reads function code

func ResetStatsCounters

func ResetStatsCounters(urlSuffix string, nodeAddrs []string) ([]byte, error)

func Retry

func Retry(b Backoff, retryCount *int64, callback CallbackFunc, args ...interface{}) error

func RoundUpToNearestPowerOf2

func RoundUpToNearestPowerOf2(number float64) int

func ScopeOrCollectionSeqnos

func ScopeOrCollectionSeqnos(cluster, pooln, bucketn string,
	id uint32) (l_seqnos []uint64, locationFound bool, err error)

func SeedProcess

func SeedProcess()

func SetBreakpad

func SetBreakpad(val bool)

func SetDcpMemcachedTimeout

func SetDcpMemcachedTimeout(val uint32)

func SetIPFlags

func SetIPFlags(ipv6Flag, ipv4Flag string)

func SetMaxFunctionSize

func SetMaxFunctionSize(size int)

func SetMetaKvMaxDocSize

func SetMetaKvMaxDocSize(size int)

func SetRestPort

func SetRestPort(flagRestPort string)

One time call

func SetSecurityConfig

func SetSecurityConfig(config *common.SecuritySetting)

func SetServicePorts

func SetServicePorts(portMap map[string]string)

func SetUseTLS

func SetUseTLS(value bool)

func SprintDCPCounts

func SprintDCPCounts(counts map[mcd.CommandCode]uint64) (string, uint64, time.Time)

func SprintV8Counts

func SprintV8Counts(counts map[string]uint64) string

func StopDebugger

func StopDebugger(nodeAddr, appLocation string)

func StrSliceDiff

func StrSliceDiff(kv1, kv2 []string) []string

func StripCurlCredentials

func StripCurlCredentials(path, appLocation string, payload []byte) ([]byte, error)

func StripScheme

func StripScheme(endpoint string) string

func SuperImpose

func SuperImpose(source, on map[string]interface{}) map[string]interface{}

func ToStr

func ToStr(value bool) (strValue string)

func ToStringArray

func ToStringArray(from interface{}) (to []string)

func Uint16SliceDiff

func Uint16SliceDiff(kv1, kv2 []uint16) []uint16

func ValidateAndCheckKeyspaceExist

func ValidateAndCheckKeyspaceExist(bucket, scope, collection, hostaddress string, wildcardAllowed bool) error

empty scope and collection argument will check for bucket existence

func VbsSliceDiff

func VbsSliceDiff(X, Y []uint16) []uint16

func VbucketByKey

func VbucketByKey(key []byte, numVbuckets int) uint16

VbucketByKey returns doc_id to vbucket mapping

func VbucketDistribution

func VbucketDistribution(vbs []uint16, numWorkers int) map[int][]uint16

VbucketDistribution is used by vbucket ownership give up and takeover routines during rebalance

func VbucketNodeAssignment

func VbucketNodeAssignment(vbs []uint16, numWorkers int) map[int][]uint16

VbucketNodeAssignment will be used as generic partitioning scheme for vbucket assignment to Eventing.Consumer and Eventing.Producer instances

func WriteAppContent

func WriteAppContent(appsPath, checksumPath, appLocation string, payload []byte, compressPayload bool) error

WriteAppContent fragments the payload and store it to metakv

Types

type Backoff

type Backoff interface {
	NextBackoff() time.Duration
	Reset()
}

type BoundedQueue

type BoundedQueue struct {
	// contains filtered or unexported fields
}

func NewBoundedQueue

func NewBoundedQueue(maxcount, maxsize uint64) *BoundedQueue

func (*BoundedQueue) Close

func (q *BoundedQueue) Close()

func (*BoundedQueue) Count

func (q *BoundedQueue) Count() uint64

func (*BoundedQueue) IsClosed

func (q *BoundedQueue) IsClosed() bool

func (*BoundedQueue) Pop

func (q *BoundedQueue) Pop() (Element, error)

func (*BoundedQueue) Push

func (q *BoundedQueue) Push(elem Element) error

type CallbackFunc

type CallbackFunc func(arg ...interface{}) error

type CbAuthHandler

type CbAuthHandler struct {
	Hostport string
	Bucket   string
}

cbauth admin authentication helper Uses default cbauth env variables internally to provide auth creds

func (*CbAuthHandler) AuthenticateMemcachedConn

func (ah *CbAuthHandler) AuthenticateMemcachedConn(host string, conn *memcached.Client) error

func (*CbAuthHandler) GetCredentials

func (ah *CbAuthHandler) GetCredentials() (string, string)

type Client

type Client struct {
	http.Client
}

func CheckTLSandGetClient

func CheckTLSandGetClient(HTTPRequestTimeout time.Duration) *Client

func NewClient

func NewClient(timeout time.Duration) *Client

func NewTLSClient

func NewTLSClient(timeout time.Duration, config *common.SecuritySetting) *Client

func (*Client) Delete

func (c *Client) Delete(url string) (resp *http.Response, err error)

func (*Client) Do

func (c *Client) Do(req *http.Request) (*http.Response, error)

func (*Client) Get

func (c *Client) Get(url string) (resp *http.Response, err error)

func (*Client) Head

func (c *Client) Head(url string) (resp *http.Response, err error)

func (*Client) Post

func (c *Client) Post(url string, contentType string, body io.Reader) (resp *http.Response, err error)

func (*Client) PostForm

func (c *Client) PostForm(url string, data url.Values) (resp *http.Response, err error)

type Clock

type Clock interface {
	Now() time.Time
}

type ClusterInfoCache

type ClusterInfoCache struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

Helper object for fetching cluster information Can be used by services running on a cluster node to connect with local management service for obtaining cluster information. Info cache can be updated by using Refresh() method.

func FetchNewClusterInfoCache

func FetchNewClusterInfoCache(clusterUrl string) (*ClusterInfoCache, error)

func (*ClusterInfoCache) Fetch

func (c *ClusterInfoCache) Fetch(np *couchbase.Pool) error

func (*ClusterInfoCache) FetchManifestInfo

func (c *ClusterInfoCache) FetchManifestInfo(bucketName string) error

func (*ClusterInfoCache) FetchWithLock

func (c *ClusterInfoCache) FetchWithLock(np *couchbase.Pool) error

func (*ClusterInfoCache) GetActiveEventingNodes

func (c *ClusterInfoCache) GetActiveEventingNodes() (nodes []couchbase.Node)

func (*ClusterInfoCache) GetAddressOfActiveKVNodes

func (c *ClusterInfoCache) GetAddressOfActiveKVNodes() (addresses []string, err error)

func (*ClusterInfoCache) GetAllNodes

func (c *ClusterInfoCache) GetAllNodes() []*Node

func (*ClusterInfoCache) GetBucketUUID

func (c *ClusterInfoCache) GetBucketUUID(bucket string) (uuid string)

Return UUID of a given bucket.

func (*ClusterInfoCache) GetBuckets

func (c *ClusterInfoCache) GetBuckets() []string

func (*ClusterInfoCache) GetClusterVersion

func (c *ClusterInfoCache) GetClusterVersion() (int, int)

func (*ClusterInfoCache) GetCollectionID

func (c *ClusterInfoCache) GetCollectionID(bucket, scope, collection string) (uint32, error)

func (*ClusterInfoCache) GetCollectionManifest

func (c *ClusterInfoCache) GetCollectionManifest(bucketName string) *collections.CollectionManifest

func (*ClusterInfoCache) GetCurrentNode

func (c *ClusterInfoCache) GetCurrentNode() NodeId

func (*ClusterInfoCache) GetExternalIPOfThisNode

func (c *ClusterInfoCache) GetExternalIPOfThisNode(hostnames []string) (string, error)

func (*ClusterInfoCache) GetFailedEventingNodes

func (c *ClusterInfoCache) GetFailedEventingNodes() (nodes []couchbase.Node)

func (*ClusterInfoCache) GetLocalHostAddress

func (c *ClusterInfoCache) GetLocalHostAddress() (string, error)

func (*ClusterInfoCache) GetLocalHostname

func (c *ClusterInfoCache) GetLocalHostname() (string, error)

func (*ClusterInfoCache) GetLocalServiceAddress

func (c *ClusterInfoCache) GetLocalServiceAddress(srvc string) (string, error)

func (*ClusterInfoCache) GetLocalServiceHost

func (c *ClusterInfoCache) GetLocalServiceHost(srvc string) (string, error)

func (*ClusterInfoCache) GetLocalServicePort

func (c *ClusterInfoCache) GetLocalServicePort(srvc string) (string, error)

func (*ClusterInfoCache) GetManifestID

func (c *ClusterInfoCache) GetManifestID(bucket string) (string, error)

func (*ClusterInfoCache) GetNewEventingNodes

func (c *ClusterInfoCache) GetNewEventingNodes() (nodes []couchbase.Node)

func (*ClusterInfoCache) GetNodeCompatVersion

func (c *ClusterInfoCache) GetNodeCompatVersion() (uint32, uint32)

func (*ClusterInfoCache) GetNodeStatus

func (c *ClusterInfoCache) GetNodeStatus(nid NodeId) (string, error)

func (*ClusterInfoCache) GetNodesByBucket

func (c *ClusterInfoCache) GetNodesByBucket(bucket string) (nids []NodeId, err error)

func (*ClusterInfoCache) GetNodesByServiceType

func (c *ClusterInfoCache) GetNodesByServiceType(srvc string) (nids []NodeId)

func (*ClusterInfoCache) GetNumVbucketsForBucket

func (c *ClusterInfoCache) GetNumVbucketsForBucket(bucketName string) int

func (*ClusterInfoCache) GetScopes

func (c *ClusterInfoCache) GetScopes(bucketName string) map[string][]string

func (*ClusterInfoCache) GetServiceAddress

func (c *ClusterInfoCache) GetServiceAddress(nid NodeId, srvc string) (addr string, err error)

func (*ClusterInfoCache) GetUniqueBSCIds

func (c *ClusterInfoCache) GetUniqueBSCIds(bucket, scope, collection string) (string, uint32, uint32, error)

func (*ClusterInfoCache) GetVBuckets

func (c *ClusterInfoCache) GetVBuckets(nid NodeId, bucket string) (vbs []uint32, err error)

func (*ClusterInfoCache) IsEphemeral

func (c *ClusterInfoCache) IsEphemeral(bucket string) (bool, error)

func (*ClusterInfoCache) IsMemcached

func (c *ClusterInfoCache) IsMemcached(bucket string) (bool, error)

func (*ClusterInfoCache) IsNodeHealthy

func (c *ClusterInfoCache) IsNodeHealthy(nid NodeId) (bool, error)

func (*ClusterInfoCache) SetLogPrefix

func (c *ClusterInfoCache) SetLogPrefix(p string)

func (*ClusterInfoCache) SetMaxRetries

func (c *ClusterInfoCache) SetMaxRetries(r int)

func (*ClusterInfoCache) SetServicePorts

func (c *ClusterInfoCache) SetServicePorts(portMap map[string]string)

func (*ClusterInfoCache) StorageEngine

func (c *ClusterInfoCache) StorageEngine(bucketName string) (common.StorageEngine, error)

type ClusterInfoClient

type ClusterInfoClient struct {
	// contains filtered or unexported fields
}

func FetchClusterInfoClient

func FetchClusterInfoClient(clusterURL string) (c *ClusterInfoClient, err error)

func (*ClusterInfoClient) Close

func (c *ClusterInfoClient) Close()

func (*ClusterInfoClient) GetClusterInfoCache

func (c *ClusterInfoClient) GetClusterInfoCache() *ClusterInfoCache

Consumer must lock returned cinfo before using it

type Config

type Config map[string]interface{}

func NewConfig

func NewConfig(data interface{}) (Config, error)

func (Config) Set

func (config Config) Set(key string, value interface{}) Config

func (Config) Update

func (config Config) Update(data interface{}) error

type ConfigHolder

type ConfigHolder struct {
	// contains filtered or unexported fields
}

func (*ConfigHolder) Load

func (h *ConfigHolder) Load() Config

func (*ConfigHolder) Store

func (h *ConfigHolder) Store(conf Config)

type DynamicAuthenticator

type DynamicAuthenticator struct {
	Caller string
}

func (*DynamicAuthenticator) Certificate

func (dynAuth *DynamicAuthenticator) Certificate(req gocb.AuthCertRequest) (*tls.Certificate, error)

func (*DynamicAuthenticator) Credentials

func (dynAuth *DynamicAuthenticator) Credentials(req gocb.AuthCredsRequest) ([]gocb.UserPassPair, error)

func (*DynamicAuthenticator) SupportsNonTLS

func (dynAuth *DynamicAuthenticator) SupportsNonTLS() bool

func (*DynamicAuthenticator) SupportsTLS

func (dynAuth *DynamicAuthenticator) SupportsTLS() bool

type Element

type Element interface {
	Size() uint64
}

type ExponentialBackoff

type ExponentialBackoff struct {
	InitialInterval     time.Duration
	RandomizationFactor float64
	Multiplier          float64
	MaxInterval         time.Duration

	// After MaxElapsedTime the ExponentialBackoff stops.
	// It never stops if MaxElapsedTime == 0.
	MaxElapsedTime time.Duration
	Clock          Clock
	// contains filtered or unexported fields
}

func NewExponentialBackoff

func NewExponentialBackoff() *ExponentialBackoff

func (*ExponentialBackoff) GetElapsedTime

func (b *ExponentialBackoff) GetElapsedTime() time.Duration

func (*ExponentialBackoff) NextBackoff

func (b *ExponentialBackoff) NextBackoff() time.Duration

func (*ExponentialBackoff) Reset

func (b *ExponentialBackoff) Reset()

type FixedBackoff

type FixedBackoff struct {
	Interval time.Duration
}

func NewFixedBackoff

func NewFixedBackoff(d time.Duration) *FixedBackoff

func (*FixedBackoff) NextBackoff

func (b *FixedBackoff) NextBackoff() time.Duration

func (*FixedBackoff) Reset

func (b *FixedBackoff) Reset()

type GocbLogger

type GocbLogger struct{}

func (*GocbLogger) Log

func (r *GocbLogger) Log(level gocb.LogLevel, offset int, format string, v ...interface{}) error

type Node

type Node struct {
	// contains filtered or unexported fields
}

func NewNode

func NewNode(hostname string) (*Node, error)

func NewNodeWithScheme

func NewNodeWithScheme(hostname, scheme string) (*Node, error)

func (Node) HasLoopbackAddress

func (n Node) HasLoopbackAddress() bool

func (*Node) IsEqual

func (n *Node) IsEqual(node *Node) bool

type NodeId

type NodeId int

type Notification

type Notification struct {
	Type NotificationType
	Msg  interface{}
}

func (Notification) String

func (n Notification) String() string

type NotificationType

type NotificationType int
const (
	ServiceChangeNotification NotificationType = iota
	PoolChangeNotification
	CollectionManifestChangeNotification
	EncryptionLevelChangeNotification
)

type PayloadHash

type PayloadHash struct {
	Fragmentcnt  int      `json:"fragment_count"`
	Fragmenthash [][]byte `json:"fragment_hash"`
}

func (*PayloadHash) Update

func (payloadhash *PayloadHash) Update(payload []byte, fragmentSize int) error

type RetryHelper

type RetryHelper struct {
	// contains filtered or unexported fields
}

Helper object to execute a function with retries and exponential backoff

func NewRetryHelper

func NewRetryHelper(
	maxRetries int,
	interval time.Duration,
	factor int,
	call retryFunc) *RetryHelper

func (*RetryHelper) Run

func (r *RetryHelper) Run() error

type ServicesChangeNotifier

type ServicesChangeNotifier struct {
	// contains filtered or unexported fields
}

func NewServicesChangeNotifier

func NewServicesChangeNotifier(clusterUrl, pool string) (*ServicesChangeNotifier, error)

Initialize change notifier object for a clusterUrl

func (*ServicesChangeNotifier) Close

func (sn *ServicesChangeNotifier) Close()

Consumer can cancel and invalidate notifier object by calling Close()

func (*ServicesChangeNotifier) GarbageCollect

func (sn *ServicesChangeNotifier) GarbageCollect(bucketlist map[string]struct{})

func (*ServicesChangeNotifier) Get

func (sn *ServicesChangeNotifier) Get() (n Notification, err error)

Call Get() method to block wait and obtain next services Config

func (*ServicesChangeNotifier) GetNotifyCh

func (sn *ServicesChangeNotifier) GetNotifyCh() chan Notification

func (*ServicesChangeNotifier) RunObserveCollectionManifestChanges

func (sn *ServicesChangeNotifier) RunObserveCollectionManifestChanges(bucketName string)

func (*ServicesChangeNotifier) StopObserveCollectionManifestChanges

func (sn *ServicesChangeNotifier) StopObserveCollectionManifestChanges(bucketName string)

type Stack

type Stack struct {
	// contains filtered or unexported fields
}

func NewStack

func NewStack() *Stack

func (*Stack) Pop

func (st *Stack) Pop() interface{}

func (*Stack) Push

func (st *Stack) Push(value interface{})

func (*Stack) Size

func (st *Stack) Size() int

func (*Stack) Top

func (st *Stack) Top() interface{}

type Stats

type Stats struct {
	// contains filtered or unexported fields
}

func NewStats

func NewStats() *Stats

func (*Stats) Append

func (s *Stats) Append(deltas common.StatsData)

func (*Stats) Close

func (s *Stats) Close()

func (*Stats) Get

func (s *Stats) Get() common.StatsData

type UUID

type UUID []byte

func NewUUID

func NewUUID() (UUID, error)

func (UUID) Str

func (u UUID) Str() string

func (UUID) Uint64

func (u UUID) Uint64() uint64

type Uint16Slice

type Uint16Slice []uint16

func (Uint16Slice) Len

func (s Uint16Slice) Len() int

func (Uint16Slice) Less

func (s Uint16Slice) Less(i, j int) bool

func (Uint16Slice) Swap

func (s Uint16Slice) Swap(i, j int)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL