Versions in this module Expand all Collapse all v0 v0.1.0 Dec 22, 2017 Changes in this version + const MsgTypeStateTransition + const StateModelNameOnlineOffline + const StateModelStateDropped + const StateModelStateOffline + const StateModelStateOnline + const TargetController + const TestClusterName + const TestResource + var ErrClusterNotSetup = errors.New("cluster not setup") + var ErrInstanceNotExist = errors.New("node does not exist in instances for cluster") + var ErrNodeAlreadyExists = errors.New("node already exists in cluster") + var ErrNodeNotExist = errors.New("node does not exist in config for cluster") + var ErrResourceExists = errors.New("resource already exists in cluster") + var ErrResourceNotExists = errors.New("resource not exists in cluster") + var ErrStateModelDefNotExist = errors.New("state model not exist in cluster") + var ErrorNilUpdatedData = errors.New("data accessor: updated data is nil") + func CreateRandomString() string + func GetRandomPort() int32 + func IdealStateKey(clusterName string, resourceName string) string + type Admin struct + func NewAdmin(zkConnectString string) (*Admin, error) + func (adm Admin) AddCluster(cluster string, recreateIfExists bool) bool + func (adm Admin) AddNode(cluster string, node string) error + func (adm Admin) AddResource(cluster string, resource string, partitions int, stateModel string) error + func (adm Admin) DisableResource(cluster string, resource string) error + func (adm Admin) DropCluster(cluster string) error + func (adm Admin) DropInstance(cluster string, instance string) error + func (adm Admin) DropNode(cluster string, node string) error + func (adm Admin) DropResource(cluster string, resource string) error + func (adm Admin) EnableResource(cluster string, resource string) error + func (adm Admin) GetConfig(cluster string, scope string, builder []string) (map[string]interface{}, error) + func (adm Admin) GetInstances(cluster string) error + func (adm Admin) ListClusterInfo(cluster string) (string, error) + func (adm Admin) ListClusters() (string, error) + func (adm Admin) ListInstanceInfo(cluster string, instance string) (string, error) + func (adm Admin) ListInstances(cluster string) (string, error) + func (adm Admin) ListResources(cluster string) (string, error) + func (adm Admin) SetConfig(cluster string, scope string, properties map[string]string) error + type BaseHelixTestSuite struct + Admin *Admin + func (s *BaseHelixTestSuite) SetupSuite() + func (s *BaseHelixTestSuite) TearDownSuite() + type DataAccessor struct + func (a *DataAccessor) CreateParticipantMsg(instanceName string, msg *model.Message) error + func (a *DataAccessor) CurrentState(instanceName, session, resourceName string) (*model.CurrentState, error) + func (a *DataAccessor) IdealState(resourceName string) (*model.IdealState, error) + func (a *DataAccessor) InstanceConfig(path string) (*model.InstanceConfig, error) + func (a *DataAccessor) LiveInstance(instanceName string) (*model.LiveInstance, error) + func (a *DataAccessor) Msg(path string) (*model.Message, error) + func (a *DataAccessor) StateModelDef(stateModel string) (*model.StateModelDef, error) + type KeyBuilder struct + type Participant interface + Connect func() error + DataAccessor func() *DataAccessor + Disconnect func() + InstanceName func() string + IsConnected func() bool + Process func(e zk.Event) + RegisterStateModel func(stateModelName string, processor *StateModelProcessor) + func NewParticipant(logger *zap.Logger, scope tally.Scope, zkConnectString string, ...) (Participant, <-chan error) + type StateModel interface + GetState func(resourceName string, partitionKey string) (string, bool) + RemoveState func(resourceName string, partitionKey string) + UpdateState func(resourceName string, partitionKey string, state string) + func NewStateModel() StateModel + type StateModelProcessor struct + Transitions map[string]map[string]StateTransitionHandler + func NewStateModelProcessor() *StateModelProcessor + func (p *StateModelProcessor) AddTransition(fromState string, toState string, handler StateTransitionHandler) + type StateTransitionHandler func(msg *model.Message) error + type TestParticipant struct + func NewTestParticipant(logger *zap.Logger, scope tally.Scope, zkConnectString string, ...) (*TestParticipant, <-chan error) + func (p *TestParticipant) GetFatalErrorChan() chan error + type Transition struct + FromState string + Handler StateTransitionHandler + ToState string