Documentation ¶
Index ¶
- Constants
- Variables
- func BuildCommandTokenExist(defnId c.IndexDefnId) (bool, error)
- func DeleteCommandTokenExist(defnId c.IndexDefnId) (bool, error)
- func GetIndexerVersionToken() (uint64, error)
- func MarshallBuildCommandToken(r *BuildCommandToken) ([]byte, error)
- func MarshallDeleteCommandToken(r *DeleteCommandToken) ([]byte, error)
- func MarshallIndexIdList(list *IndexIdList) ([]byte, error)
- func MarshallIndexStats(stats *IndexStats) ([]byte, error)
- func MarshallIndexerVersionToken(r *IndexerVersionToken) ([]byte, error)
- func MarshallServiceMap(srvMap *ServiceMap) ([]byte, error)
- func PostBuildCommandToken(defnId c.IndexDefnId) error
- func PostDeleteCommandToken(defnId c.IndexDefnId) error
- func PostIndexerVersionToken(version uint64) error
- type BuildCommandToken
- type DeleteCommandToken
- type GlobalTopology
- type IndexDefnDistribution
- type IndexIdList
- type IndexInstDistribution
- type IndexKeyPartDistribution
- type IndexMetadata
- type IndexPartDistribution
- type IndexSinglePartDistribution
- type IndexSliceLocator
- type IndexStats
- type IndexTopology
- type IndexerStatus
- type IndexerVersionToken
- type InstanceDefn
- type MetadataProvider
- func (o *MetadataProvider) AllWatchersAlive() bool
- func (o *MetadataProvider) AllWatchersAliveNoLock() bool
- func (o *MetadataProvider) BuildIndexes(defnIDs []c.IndexDefnId) error
- func (o *MetadataProvider) CheckIndexerStatus() []IndexerStatus
- func (o *MetadataProvider) CheckIndexerStatusNoLock() []IndexerStatus
- func (o *MetadataProvider) Close()
- func (o *MetadataProvider) CreateIndexWithPlan(name, bucket, using, exprType, partnExpr, whereExpr string, secExprs []string, ...) (c.IndexDefnId, error, bool)
- func (o *MetadataProvider) DropIndex(defnID c.IndexDefnId) error
- func (o *MetadataProvider) FindIndex(id c.IndexDefnId) *IndexMetadata
- func (o *MetadataProvider) FindIndexByName(name string, bucket string) *IndexMetadata
- func (o *MetadataProvider) FindIndexIgnoreStatus(id c.IndexDefnId) *IndexMetadata
- func (o *MetadataProvider) FindServiceForIndexer(id c.IndexerId) (adminport string, queryport string, httpport string, err error)
- func (o *MetadataProvider) GetClusterVersion() uint64
- func (o *MetadataProvider) GetIndexerVersion() uint64
- func (o *MetadataProvider) GetMetadataVersion() uint64
- func (o *MetadataProvider) IncrementMetadataVersion()
- func (o *MetadataProvider) IsWatcherAlive(nodeUUID string) bool
- func (o *MetadataProvider) ListIndex() ([]*IndexMetadata, uint64)
- func (o *MetadataProvider) PrepareIndexDefn(name, bucket, using, exprType, partnExpr, whereExpr string, secExprs []string, ...) (*c.IndexDefn, error, bool)
- func (o *MetadataProvider) RefreshIndexerVersion() uint64
- func (o *MetadataProvider) SetClusterStatus(numExpectedWatcher int, numFailedNode int, numUnhealthyNode int, ...)
- func (o *MetadataProvider) SetTimeout(timeout int64)
- func (o *MetadataProvider) UnwatchMetadata(indexerId c.IndexerId, numExpectedWatcher int)
- func (o *MetadataProvider) UpdateServiceAddrForIndexer(id c.IndexerId, adminport string) error
- func (o *MetadataProvider) WatchMetadata(indexAdminPort string, callback watcherCallback, numExpectedWatcher int) c.IndexerId
- type ServiceMap
- type Settings
Constants ¶
const ( OPCODE_CREATE_INDEX common.OpCode = common.OPCODE_CUSTOM + 1 OPCODE_DROP_INDEX = OPCODE_CREATE_INDEX + 1 OPCODE_BUILD_INDEX = OPCODE_DROP_INDEX + 1 OPCODE_UPDATE_INDEX_INST = OPCODE_BUILD_INDEX + 1 OPCODE_SERVICE_MAP = OPCODE_UPDATE_INDEX_INST + 1 OPCODE_DELETE_BUCKET = OPCODE_SERVICE_MAP + 1 OPCODE_INDEXER_READY = OPCODE_DELETE_BUCKET + 1 OPCODE_CLEANUP_INDEX = OPCODE_INDEXER_READY + 1 OPCODE_CLEANUP_DEFER_INDEX = OPCODE_CLEANUP_INDEX + 1 OPCODE_CREATE_INDEX_REBAL = OPCODE_CLEANUP_DEFER_INDEX + 1 OPCODE_BUILD_INDEX_REBAL = OPCODE_CREATE_INDEX_REBAL + 1 OPCODE_DROP_INDEX_REBAL = OPCODE_BUILD_INDEX_REBAL + 1 OPCODE_BROADCAST_STATS = OPCODE_DROP_INDEX_REBAL + 1 OPCODE_BUILD_INDEX_RETRY = OPCODE_BROADCAST_STATS + 1 OPCODE_RESET_INDEX = OPCODE_BUILD_INDEX_RETRY + 1 OPCODE_CONFIG_UPDATE = OPCODE_RESET_INDEX + 1 )
const BuildDDLCommandTokenPath = DDLMetakvDir + BuildDDLCommandTokenTag
const BuildDDLCommandTokenTag = "commandToken/build/"
const DDLMetakvDir = c.IndexingMetaDir + "ddl/"
const DeleteDDLCommandTokenPath = DDLMetakvDir + DeleteDDLCommandTokenTag
const DeleteDDLCommandTokenTag = "commandToken/delete/"
const IndexerVersionTokenPath = InfoMetakvDir + IndexerVersionTokenTag
const IndexerVersionTokenTag = "versionToken"
const InfoMetakvDir = c.IndexingMetaDir + "info/"
Variables ¶
var REQUEST_CHANNEL_COUNT = 1000
Functions ¶
func BuildCommandTokenExist ¶
func BuildCommandTokenExist(defnId c.IndexDefnId) (bool, error)
Does token exist? Return true only if token exist and there is no error.
func DeleteCommandTokenExist ¶
func DeleteCommandTokenExist(defnId c.IndexDefnId) (bool, error)
Does token exist? Return true only if token exist and there is no error.
func GetIndexerVersionToken ¶
Does token exist? Return true only if token exist and there is no error.
func MarshallBuildCommandToken ¶
func MarshallBuildCommandToken(r *BuildCommandToken) ([]byte, error)
Marshall
func MarshallDeleteCommandToken ¶
func MarshallDeleteCommandToken(r *DeleteCommandToken) ([]byte, error)
func MarshallIndexIdList ¶
func MarshallIndexIdList(list *IndexIdList) ([]byte, error)
func MarshallIndexStats ¶
func MarshallIndexStats(stats *IndexStats) ([]byte, error)
func MarshallIndexerVersionToken ¶
func MarshallIndexerVersionToken(r *IndexerVersionToken) ([]byte, error)
func MarshallServiceMap ¶
func MarshallServiceMap(srvMap *ServiceMap) ([]byte, error)
func PostBuildCommandToken ¶
func PostBuildCommandToken(defnId c.IndexDefnId) error
Generate a token to metakv for recovery purpose
func PostDeleteCommandToken ¶
func PostDeleteCommandToken(defnId c.IndexDefnId) error
Generate a token to metakv for recovery purpose
func PostIndexerVersionToken ¶
Generate a token to metakv for indexer version
Types ¶
type BuildCommandToken ¶
type BuildCommandToken struct { Name string Bucket string DefnId c.IndexDefnId }
func UnmarshallBuildCommandToken ¶
func UnmarshallBuildCommandToken(data []byte) (*BuildCommandToken, error)
Unmarshall
type DeleteCommandToken ¶
type DeleteCommandToken struct { Name string Bucket string DefnId c.IndexDefnId }
func UnmarshallDeleteCommandToken ¶
func UnmarshallDeleteCommandToken(data []byte) (*DeleteCommandToken, error)
Unmarshall
type GlobalTopology ¶
type GlobalTopology struct {
TopologyKeys []string `json:"topologyKeys,omitempty"`
}
type IndexDefnDistribution ¶
type IndexDefnDistribution struct { Bucket string `json:"bucket,omitempty"` Name string `json:"name,omitempty"` DefnId uint64 `json:"defnId,omitempty"` Instances []IndexInstDistribution `json:"instances,omitempty"` }
type IndexIdList ¶
type IndexIdList struct {
DefnIds []uint64 `json:"defnIds,omitempty"`
}
func BuildIndexIdList ¶
func BuildIndexIdList(ids []c.IndexDefnId) *IndexIdList
func UnmarshallIndexIdList ¶
func UnmarshallIndexIdList(data []byte) (*IndexIdList, error)
type IndexInstDistribution ¶
type IndexInstDistribution struct { InstId uint64 `json:"instId,omitempty"` State uint32 `json:"state,omitempty"` StreamId uint32 `json:"streamId,omitempty"` Error string `json:"error,omitempty"` Partitions []IndexPartDistribution `json:"partitions,omitempty"` RState uint32 `json:"rRtate,omitempty"` Version uint64 `json:"version,omitempty"` ReplicaId uint64 `json:"replicaId,omitempty"` Scheduled bool `json:"scheduled,omitempty"` StorageMode string `json:"storageMode,omitempty"` OldStorageMode string `json:"oldStorageMode,omitempty"` }
type IndexKeyPartDistribution ¶
type IndexKeyPartDistribution struct { Keys []string `json:"keys,omitempty"` SinglePartitions []IndexSinglePartDistribution `json:"singlePartitions,omitempty"` }
type IndexMetadata ¶
type IndexMetadata struct { Definition *c.IndexDefn Instances []*InstanceDefn InstsInRebalance []*InstanceDefn State c.IndexState Error string }
type IndexPartDistribution ¶
type IndexPartDistribution struct { PartId uint64 `json:"partId,omitempty"` SinglePartition IndexSinglePartDistribution `json:"singlePartition,omitempty"` KeyPartition IndexKeyPartDistribution `json:"keyPartition,omitempty"` }
type IndexSinglePartDistribution ¶
type IndexSinglePartDistribution struct {
Slices []IndexSliceLocator `json:"slices,omitempty"`
}
type IndexSliceLocator ¶
type IndexStats ¶
type IndexStats struct {
Stats c.Statistics `json:"stats,omitempty"`
}
func UnmarshallIndexStats ¶
func UnmarshallIndexStats(data []byte) (*IndexStats, error)
type IndexTopology ¶
type IndexTopology struct { Version uint64 `json:"version,omitempty"` Bucket string `json:"bucket,omitempty"` Definitions []IndexDefnDistribution `json:"definitions,omitempty"` }
func (*IndexTopology) GetIndexInstByDefn ¶
func (t *IndexTopology) GetIndexInstByDefn(defnId c.IndexDefnId) *IndexInstDistribution
func (*IndexTopology) GetStatusByDefn ¶
func (t *IndexTopology) GetStatusByDefn(defnId c.IndexDefnId) (c.IndexState, string)
type IndexerStatus ¶
type IndexerVersionToken ¶
type IndexerVersionToken struct {
Version uint64
}
func UnmarshallIndexerVersionToken ¶
func UnmarshallIndexerVersionToken(data []byte) (*IndexerVersionToken, error)
Unmarshall
type InstanceDefn ¶
type InstanceDefn struct { DefnId c.IndexDefnId InstId c.IndexInstId State c.IndexState Error string IndexerId c.IndexerId Endpts []c.Endpoint Version uint64 RState uint32 ReplicaId uint64 StorageMode string }
type MetadataProvider ¶
type MetadataProvider struct {
// contains filtered or unexported fields
}
func NewMetadataProvider ¶
func NewMetadataProvider(providerId string, changeCh chan bool, statsCh chan map[c.IndexInstId]c.Statistics, settings Settings) (s *MetadataProvider, err error)
func (*MetadataProvider) AllWatchersAlive ¶
func (o *MetadataProvider) AllWatchersAlive() bool
Since this function holds the lock, it ensure that neither WatchMetadata or UnwatchMetadata is being called. It also ensure safety of calling CheckIndexerStatusNoLock.
func (*MetadataProvider) AllWatchersAliveNoLock ¶
func (o *MetadataProvider) AllWatchersAliveNoLock() bool
The caller of this function must hold lock to ensure mutual exclusiveness. The lock is used to prevent concurrent WatchMetadata/UnwatchMetadata being called, as well as to protect CheckIndexerStatusNoLock.
func (*MetadataProvider) BuildIndexes ¶
func (o *MetadataProvider) BuildIndexes(defnIDs []c.IndexDefnId) error
func (*MetadataProvider) CheckIndexerStatus ¶
func (o *MetadataProvider) CheckIndexerStatus() []IndexerStatus
Since this function holds the lock, it ensure that neither WatchMetadata or UnwatchMetadata is being called. It also ensure safety of calling CheckIndexerStatusNoLock.
func (*MetadataProvider) CheckIndexerStatusNoLock ¶
func (o *MetadataProvider) CheckIndexerStatusNoLock() []IndexerStatus
It is important the caller of this function holds a lock to ensure this function is mutual exclusive.
func (*MetadataProvider) Close ¶
func (o *MetadataProvider) Close()
func (*MetadataProvider) CreateIndexWithPlan ¶
func (o *MetadataProvider) CreateIndexWithPlan( name, bucket, using, exprType, partnExpr, whereExpr string, secExprs []string, desc []bool, isPrimary bool, plan map[string]interface{}) (c.IndexDefnId, error, bool)
func (*MetadataProvider) DropIndex ¶
func (o *MetadataProvider) DropIndex(defnID c.IndexDefnId) error
func (*MetadataProvider) FindIndex ¶
func (o *MetadataProvider) FindIndex(id c.IndexDefnId) *IndexMetadata
func (*MetadataProvider) FindIndexByName ¶
func (o *MetadataProvider) FindIndexByName(name string, bucket string) *IndexMetadata
func (*MetadataProvider) FindIndexIgnoreStatus ¶
func (o *MetadataProvider) FindIndexIgnoreStatus(id c.IndexDefnId) *IndexMetadata
func (*MetadataProvider) FindServiceForIndexer ¶
func (*MetadataProvider) GetClusterVersion ¶
func (o *MetadataProvider) GetClusterVersion() uint64
Get the Cluster Version
func (*MetadataProvider) GetIndexerVersion ¶
func (o *MetadataProvider) GetIndexerVersion() uint64
Get the Indexer Version
func (*MetadataProvider) GetMetadataVersion ¶
func (o *MetadataProvider) GetMetadataVersion() uint64
func (*MetadataProvider) IncrementMetadataVersion ¶
func (o *MetadataProvider) IncrementMetadataVersion()
func (*MetadataProvider) IsWatcherAlive ¶
func (o *MetadataProvider) IsWatcherAlive(nodeUUID string) bool
Find out if a watcher is alive
func (*MetadataProvider) ListIndex ¶
func (o *MetadataProvider) ListIndex() ([]*IndexMetadata, uint64)
func (*MetadataProvider) PrepareIndexDefn ¶
func (*MetadataProvider) RefreshIndexerVersion ¶
func (o *MetadataProvider) RefreshIndexerVersion() uint64
Refresh the indexer version. This will look at both metakv and indexers to figure out the latest version. This function still be 0 if (1) there are failed nodes and, (2) during upgrade to 5.0.
func (*MetadataProvider) SetClusterStatus ¶
func (o *MetadataProvider) SetClusterStatus(numExpectedWatcher int, numFailedNode int, numUnhealthyNode int, numAddNode int)
func (*MetadataProvider) SetTimeout ¶
func (o *MetadataProvider) SetTimeout(timeout int64)
func (*MetadataProvider) UnwatchMetadata ¶
func (o *MetadataProvider) UnwatchMetadata(indexerId c.IndexerId, numExpectedWatcher int)
func (*MetadataProvider) UpdateServiceAddrForIndexer ¶
func (o *MetadataProvider) UpdateServiceAddrForIndexer(id c.IndexerId, adminport string) error
func (*MetadataProvider) WatchMetadata ¶
func (o *MetadataProvider) WatchMetadata(indexAdminPort string, callback watcherCallback, numExpectedWatcher int) c.IndexerId
type ServiceMap ¶
type ServiceMap struct { IndexerId string `json:"indexerId,omitempty"` ScanAddr string `json:"scanAddr,omitempty"` HttpAddr string `json:"httpAddr,omitempty"` AdminAddr string `json:"adminAddr,omitempty"` NodeAddr string `json:"nodeAddr,omitempty"` ServerGroup string `json:"serverGroup,omitempty"` NodeUUID string `json:"nodeUUID,omitempty"` IndexerVersion uint64 `json:"indexerVersion,omitempty"` ClusterVersion uint64 `json:"clusterVersion,omitempty"` }
func UnmarshallServiceMap ¶
func UnmarshallServiceMap(data []byte) (*ServiceMap, error)