Documentation ¶
Index ¶
- type Cfg
- type ContainerAdapter
- func (c *ContainerAdapter) Clone() prophet.Container
- func (c *ContainerAdapter) ID() uint64
- func (c *ContainerAdapter) Lables() []prophet.Pair
- func (c *ContainerAdapter) Marshal() ([]byte, error)
- func (c *ContainerAdapter) State() prophet.State
- func (c *ContainerAdapter) Unmarshal(data []byte) error
- type FragmentsState
- type PeerReplicate
- type ProphetAdapter
- func (pa *ProphetAdapter) ChangeLeader(resourceID uint64, newLeader *prophet.Peer)
- func (pa *ProphetAdapter) ChangePeer(resourceID uint64, peer *prophet.Peer, changeType prophet.ChangePeerType)
- func (pa *ProphetAdapter) ContainerHBInterval() time.Duration
- func (pa *ProphetAdapter) FetchContainerHB() *prophet.ContainerHeartbeatReq
- func (pa *ProphetAdapter) FetchLeaderResources() []uint64
- func (pa *ProphetAdapter) FetchResourceHB(id uint64) *prophet.ResourceHeartbeatReq
- func (pa *ProphetAdapter) HBHandler() prophet.HeartbeatHandler
- func (pa *ProphetAdapter) NewContainer() prophet.Container
- func (pa *ProphetAdapter) NewResource() prophet.Resource
- func (pa *ProphetAdapter) ResourceHBInterval() time.Duration
- type ResourceAdapter
- func (r *ResourceAdapter) Changed(other prophet.Resource) bool
- func (r *ResourceAdapter) Clone() prophet.Resource
- func (r *ResourceAdapter) ID() uint64
- func (r *ResourceAdapter) Marshal() ([]byte, error)
- func (r *ResourceAdapter) Peers() []*prophet.Peer
- func (r *ResourceAdapter) SetPeers(peers []*prophet.Peer)
- func (r *ResourceAdapter) Stale(other prophet.Resource) bool
- func (r *ResourceAdapter) Unmarshal(data []byte) error
- type Seata
- type Store
- type Transport
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Cfg ¶
type Cfg struct { Addr string ShardingAddr string DataPath string Labels []prophet.Pair ProphetName string FragHBInterval time.Duration StoreHBInterval time.Duration MaxPeerDownDuration time.Duration RMLease time.Duration CoreOptions []core.Option InitFragments int Concurrency int OverloadPercentage uint64 OverloadPeriod uint64 TransSendCB func(meta.ResourceManager, meta.Notify) error TransWorkerCount int PRWorkerCount int // contains filtered or unexported fields }
Cfg raftstore configuration
type ContainerAdapter ¶
type ContainerAdapter struct {
// contains filtered or unexported fields
}
ContainerAdapter adapter for prophet's container and store
func (*ContainerAdapter) Clone ¶
func (c *ContainerAdapter) Clone() prophet.Container
Clone adapter prophet
func (*ContainerAdapter) Lables ¶
func (c *ContainerAdapter) Lables() []prophet.Pair
Lables adapter prophet
func (*ContainerAdapter) Marshal ¶
func (c *ContainerAdapter) Marshal() ([]byte, error)
Marshal adapter prophet
func (*ContainerAdapter) State ¶
func (c *ContainerAdapter) State() prophet.State
State adapter prophet
func (*ContainerAdapter) Unmarshal ¶
func (c *ContainerAdapter) Unmarshal(data []byte) error
Unmarshal adapter prophet
type FragmentsState ¶
type FragmentsState struct {
FragmentCount, FragmentLeaderCount uint64
}
FragmentsState fragments state
type PeerReplicate ¶
PeerReplicate is the fragment peer replicatation. Every Fragment has N replicatation in N stores.
type ProphetAdapter ¶
type ProphetAdapter struct {
// contains filtered or unexported fields
}
ProphetAdapter adapter prophet
func (*ProphetAdapter) ChangeLeader ¶
func (pa *ProphetAdapter) ChangeLeader(resourceID uint64, newLeader *prophet.Peer)
ChangeLeader prophet adapter
func (*ProphetAdapter) ChangePeer ¶
func (pa *ProphetAdapter) ChangePeer(resourceID uint64, peer *prophet.Peer, changeType prophet.ChangePeerType)
ChangePeer prophet adapter
func (*ProphetAdapter) ContainerHBInterval ¶
func (pa *ProphetAdapter) ContainerHBInterval() time.Duration
ContainerHBInterval fetch container HB interface
func (*ProphetAdapter) FetchContainerHB ¶
func (pa *ProphetAdapter) FetchContainerHB() *prophet.ContainerHeartbeatReq
FetchContainerHB fetch container HB
func (*ProphetAdapter) FetchLeaderResources ¶
func (pa *ProphetAdapter) FetchLeaderResources() []uint64
FetchLeaderResources fetch all local leader resources
func (*ProphetAdapter) FetchResourceHB ¶
func (pa *ProphetAdapter) FetchResourceHB(id uint64) *prophet.ResourceHeartbeatReq
FetchResourceHB fetch resource HB
func (*ProphetAdapter) HBHandler ¶
func (pa *ProphetAdapter) HBHandler() prophet.HeartbeatHandler
HBHandler HB hander
func (*ProphetAdapter) NewContainer ¶
func (pa *ProphetAdapter) NewContainer() prophet.Container
NewContainer return a new container
func (*ProphetAdapter) NewResource ¶
func (pa *ProphetAdapter) NewResource() prophet.Resource
NewResource return a new resource
func (*ProphetAdapter) ResourceHBInterval ¶
func (pa *ProphetAdapter) ResourceHBInterval() time.Duration
ResourceHBInterval fetch resource HB interface
type ResourceAdapter ¶
type ResourceAdapter struct {
// contains filtered or unexported fields
}
ResourceAdapter adapter for prophet's resource and db
func (*ResourceAdapter) Changed ¶
func (r *ResourceAdapter) Changed(other prophet.Resource) bool
Changed adapter prophet
func (*ResourceAdapter) Clone ¶
func (r *ResourceAdapter) Clone() prophet.Resource
Clone adapter prophet
func (*ResourceAdapter) Marshal ¶
func (r *ResourceAdapter) Marshal() ([]byte, error)
Marshal adapter prophet
func (*ResourceAdapter) Peers ¶
func (r *ResourceAdapter) Peers() []*prophet.Peer
Peers adapter prophet
func (*ResourceAdapter) SetPeers ¶
func (r *ResourceAdapter) SetPeers(peers []*prophet.Peer)
SetPeers adapter prophet
func (*ResourceAdapter) Stale ¶
func (r *ResourceAdapter) Stale(other prophet.Resource) bool
Stale adapter prophet
func (*ResourceAdapter) Unmarshal ¶
func (r *ResourceAdapter) Unmarshal(data []byte) error
Unmarshal adapter prophet
type Store ¶
type Store interface { // Meta returns the current store's metadata Meta() meta.StoreMeta // Cfg returns the configuration Cfg() Cfg // Start start all fragments managed by the store Start() // FragmentsState returns the state of the fragments FragmentsState() FragmentsState // GetStoreAddr returns the store address GetStoreAddr(storeID uint64) (string, error) // LeaderPeer returns the fragment's leader peer LeaderPeer(fid uint64) (prophet.Peer, error) // CreateFragment create a new fragment and save it to the local data CreateFragment() meta.Fragment // MustPutFragment update the store's fragment metadata MustPutFragment(frag meta.Fragment) // GetFragment returns a fragment replicatation from the store, // when `leader` is true, only return the leader replicatation GetFragment(fid uint64, leader bool) *PeerReplicate // ForeachReplicate do something on every `replicatations`, break if the funcation return false ForeachReplicate(func(*PeerReplicate) bool) // AddReplicate add a replicatation AddReplicate(*PeerReplicate) // AddPeer add a peer to the exist fragment AddPeer(fid uint64, peer prophet.Peer) // RemovePeer remove the peer from the exist fragment RemovePeer(uint64, prophet.Peer) // Transport returns the seata message transport Transport() transport.Transport // ShardingTransport returns the sharding message transport ShardingTransport() Transport // HandleShardingMsg handle the sharding message, maybe returns a response. HandleShardingMsg(data interface{}) interface{} // AddRM add a resource manager AddRM(rms meta.ResourceManagerSet) // RenewRMLease renew the resource manager's lease RenewRMLease(pid, sid string) }
Store is a container of fragments, which maintains a set of fragments