Documentation
¶
Index ¶
- Variables
- type BeforeSnapshotAware
- type Distributable
- type DistributableItem
- type DistributeRequest
- type DistributeService
- type Distributor
- type FSM
- type KvExecutable
- type KvOperate
- type KvRequest
- type Map
- type MarshalTypesRegister
- type MemKvService
- 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 BeforeSnapshotAware ¶
type BeforeSnapshotAware interface {
BeforeSnapshot()
}
type Distributable ¶
type Distributable interface {
GetDistributableItems() any
}
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 any
}
func (DistributeRequest) GetSubData ¶
func (s DistributeRequest) GetSubData() any
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 any) error
func (*DistributeService) GetReqDataType ¶
func (m *DistributeService) GetReqDataType() any
func (*DistributeService) NewLog ¶
func (m *DistributeService) NewLog(nodeID string, request any) any
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 any) 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 KvExecutable ¶
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 any) error
func (*MemKvService) Exec ¶
func (m *MemKvService) Exec(req KvRequest) any
func (*MemKvService) GetReqDataType ¶
func (m *MemKvService) GetReqDataType() any
func (*MemKvService) RegisterMarshalTypes ¶
func (m *MemKvService) RegisterMarshalTypes(t *marshal.TypeRegister)
RegisterMarshalTypes registers the types for marshaling and unmarshaling.
type Picker ¶
type Picker interface { PickForNode(node string, request any) MarshalTypesRegister }
type PickerFn ¶
func (PickerFn) PickForNode ¶
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 any) any // GetReqDataType returns all the request structs which are used by this FSMService GetReqDataType() any // ApplySnapshot is used to decode and apply a snapshot to the FSMService ApplySnapshot(shortNodeID string, input any) error MarshalTypesRegister }
Service interface makes it easier to build State Machines
type SubDataAware ¶
type SubDataAware interface {
GetSubData() any
}
type SubDataTypeAware ¶
Click to show internal directories.
Click to hide internal directories.