Documentation ¶
Index ¶
- Variables
- type Distributable
- type DistributableItem
- type DistributeRequest
- type DistributeService
- type Distributor
- type FSM
- type KvExectable
- type KvOperate
- type KvRequest
- type Map
- type MarshalTypesRegister
- type MemKvService
- func (m *MemKvService) ApplySnapshot(nodeID string, input interface{}) error
- func (m *MemKvService) Exec(req KvRequest) interface{}
- func (m *MemKvService) GetReqDataType() interface{}
- func (m *MemKvService) NewLog(nodeID string, req interface{}) interface{}
- func (m *MemKvService) RegisterMarshalTypes(typeRegister *marshal.TypeRegister)
- type Picker
- type PickerFn
- type ReqTypeInfo
- type Service
- type Snapshot
- type SubDataAware
- type SubDataTypeAware
Constants ¶
This section is empty.
Variables ¶
View Source
var ( SubDataTypeAwareType = reflect.TypeOf((*SubDataTypeAware)(nil)).Elem() SubDataAwareType = reflect.TypeOf((*SubDataAware)(nil)).Elem() )
Functions ¶
This section is empty.
Types ¶
type Distributable ¶
type Distributable interface {
GetDistributableItems() interface{}
}
Distributable enable the distribution of struct.
type DistributableItem ¶
DistributableItem gives the ID getter.
func GetDistributable ¶
func GetDistributable(dataItem reflect.Value) (DistributableItem, bool)
type DistributeRequest ¶
type DistributeRequest struct {
Data interface{}
}
func (DistributeRequest) GetSubData ¶
func (s DistributeRequest) GetSubData() interface{}
func (DistributeRequest) Marshal ¶
func (s DistributeRequest) Marshal(t *marshal.TypeRegister) ([]byte, error)
func (*DistributeRequest) Unmarshal ¶
func (s *DistributeRequest) Unmarshal(t *marshal.TypeRegister, d []byte) (err error)
type DistributeService ¶
type DistributeService struct {
Picker
}
func NewDistributeService ¶
func NewDistributeService(picker Picker) *DistributeService
func (*DistributeService) ApplySnapshot ¶
func (m *DistributeService) ApplySnapshot(nodeID string, input interface{}) error
func (*DistributeService) GetReqDataType ¶
func (m *DistributeService) GetReqDataType() interface{}
func (*DistributeService) NewLog ¶
func (m *DistributeService) NewLog(nodeID string, request interface{}) interface{}
func (*DistributeService) RegisterMarshalTypes ¶
func (m *DistributeService) RegisterMarshalTypes(reg *marshal.TypeRegister)
RegisterMarshalTypes registers the types for marshaling and unmarshaling.
type Distributor ¶
Distributor is the role to charge the distribution among the raft cluster nodes.
func (*Distributor) CleanSticky ¶
func (d *Distributor) CleanSticky()
CleanSticky cleans the sticky map state.
func (*Distributor) Distribute ¶
func (d *Distributor) Distribute(shortNodeIds []string, data interface{}) int
Distribute do the distribution.
func (*Distributor) StickTo ¶
func (d *Distributor) StickTo(itemID, shortNodeID string)
StickTo stick a item to a node.
type FSM ¶
type FSM struct { RaftLogSum uint64 // contains filtered or unexported fields }
func NewRoutingFSM ¶
func NewRoutingFSM(shortNodeID string, services []Service, ser *marshal.TypeRegister) *FSM
type KvExectable ¶
type KvExectable interface {
Exec(req KvRequest) interface{}
}
type Map ¶
type Map struct { Data map[string]interface{} // contains filtered or unexported fields }
type MarshalTypesRegister ¶
type MarshalTypesRegister interface { // RegisterMarshalTypes registers the types for marshaling and unmarshaling. RegisterMarshalTypes(reg *marshal.TypeRegister) }
type MemKvService ¶
func NewMemKvService ¶
func NewMemKvService() *MemKvService
func (*MemKvService) ApplySnapshot ¶
func (m *MemKvService) ApplySnapshot(nodeID string, input interface{}) error
func (*MemKvService) Exec ¶
func (m *MemKvService) Exec(req KvRequest) interface{}
func (*MemKvService) GetReqDataType ¶
func (m *MemKvService) GetReqDataType() interface{}
func (*MemKvService) NewLog ¶
func (m *MemKvService) NewLog(nodeID string, req interface{}) interface{}
func (*MemKvService) RegisterMarshalTypes ¶
func (m *MemKvService) RegisterMarshalTypes(typeRegister *marshal.TypeRegister)
RegisterMarshalTypes registers the types for marshaling and unmarshaling.
type Picker ¶
type Picker interface { PickForNode(node string, request interface{}) MarshalTypesRegister }
type ReqTypeInfo ¶
func MakeReqTypeInfo ¶
func MakeReqTypeInfo(service Service) ReqTypeInfo
type Service ¶
type Service interface { // NewLog is called when a new raft log message is committed in the cluster and matched with any of the GetReqDataTypes returned types // in this method we can handle what should happen when we got a new raft log regarding our FSM service NewLog(shortNodeID string, request interface{}) interface{} // GetReqDataType returns all the request structs which are used by this FSMService GetReqDataType() interface{} // ApplySnapshot is used to decode and apply a snapshot to the FSMService ApplySnapshot(shortNodeID string, input interface{}) error MarshalTypesRegister }
Service interface makes it easier to build State Machines
type SubDataAware ¶
type SubDataAware interface {
GetSubData() interface{}
}
type SubDataTypeAware ¶
Click to show internal directories.
Click to hide internal directories.