Documentation ¶
Index ¶
- Constants
- Variables
- type CommandType
- type DaprHostMember
- type DaprHostMemberState
- func (s *DaprHostMemberState) APILevel() uint32
- func (s *DaprHostMemberState) ForEachHost(fn func(*DaprHostMember) bool)
- func (s *DaprHostMemberState) ForEachHostInNamespace(ns string, fn func(*DaprHostMember) bool)
- func (s *DaprHostMemberState) ForEachNamespace(fn func(string, *daprNamespace) bool)
- func (s *DaprHostMemberState) Index() uint64
- func (s *DaprHostMemberState) MemberCount() int
- func (s *DaprHostMemberState) MemberCountInNamespace(ns string) int
- func (s *DaprHostMemberState) NamespaceCount() int
- func (s *DaprHostMemberState) TableGeneration() uint64
- func (s *DaprHostMemberState) UpsertRequired(ns string, new *placementv1pb.Host) bool
- type DaprHostMemberStateConfig
- type DaprHostMemberStateData
- type FSM
- type Options
- type PeerInfo
- type Server
- func (s *Server) ApplyCommand(cmdType CommandType, data DaprHostMember) (bool, error)
- func (s *Server) FSM() *FSM
- func (s *Server) GetID() string
- func (s *Server) GetRaftBind() string
- func (s *Server) IsLeader() bool
- func (s *Server) Raft(ctx context.Context) (*raft.Raft, error)
- func (s *Server) StartRaft(ctx context.Context) error
Constants ¶
const (
NoVirtualNodesInPlacementTablesAPILevel = 20
)
Variables ¶
var ErrNamespaceNotFound = errors.New("namespace not found")
Functions ¶
This section is empty.
Types ¶
type CommandType ¶
type CommandType uint8
CommandType is the type of raft command in log entry.
const ( // MemberUpsert is the command to update or insert new or existing member info. MemberUpsert CommandType = 0 // MemberRemove is the command to remove member from actor host member state. MemberRemove CommandType = 1 // TableDisseminate is the reserved command for dissemination loop. TableDisseminate CommandType = 100 )
type DaprHostMember ¶
type DaprHostMember struct { // Name is the unique name of Dapr runtime host. Name string // AppID is Dapr runtime app ID. AppID string // Namespace is the namespace of the Dapr runtime host. Namespace string // Entities is the list of Actor Types which this Dapr runtime supports. Entities []string // UpdatedAt is the last time when this host member info is updated. UpdatedAt int64 // Version of the Actor APIs supported by the Dapr runtime APILevel uint32 }
DaprHostMember represents Dapr runtime actor host member which serve actor types.
func (*DaprHostMember) NamespaceAndName ¶
func (d *DaprHostMember) NamespaceAndName() string
type DaprHostMemberState ¶
type DaprHostMemberState struct {
// contains filtered or unexported fields
}
DaprHostMemberState is the wrapper over DaprHostMemberStateData that includes the cluster config and lock
func (*DaprHostMemberState) APILevel ¶
func (s *DaprHostMemberState) APILevel() uint32
APILevel returns the current API level of the cluster.
func (*DaprHostMemberState) ForEachHost ¶
func (s *DaprHostMemberState) ForEachHost(fn func(*DaprHostMember) bool)
ForEachHost loops through hosts across all namespaces and runs the provided function Early exit can be achieved by returning false from the provided function
func (*DaprHostMemberState) ForEachHostInNamespace ¶
func (s *DaprHostMemberState) ForEachHostInNamespace(ns string, fn func(*DaprHostMember) bool)
ForEachHostInNamespace loops through all hosts in a namespace and runs the provided function Early exit can be achieved by returning false from the provided function
func (*DaprHostMemberState) ForEachNamespace ¶
func (s *DaprHostMemberState) ForEachNamespace(fn func(string, *daprNamespace) bool)
ForEachNamespace loops through all namespaces and runs the provided function Early exit can be achieved by returning false from the provided function
func (*DaprHostMemberState) Index ¶
func (s *DaprHostMemberState) Index() uint64
func (*DaprHostMemberState) MemberCount ¶
func (s *DaprHostMemberState) MemberCount() int
MemberCount returns number of hosts in a namespace
func (*DaprHostMemberState) MemberCountInNamespace ¶
func (s *DaprHostMemberState) MemberCountInNamespace(ns string) int
MemberCountInNamespace returns number of hosts in a namespace
func (*DaprHostMemberState) NamespaceCount ¶
func (s *DaprHostMemberState) NamespaceCount() int
NamespaceCount returns the number of namespaces in the store
func (*DaprHostMemberState) TableGeneration ¶
func (s *DaprHostMemberState) TableGeneration() uint64
func (*DaprHostMemberState) UpsertRequired ¶
func (s *DaprHostMemberState) UpsertRequired(ns string, new *placementv1pb.Host) bool
UpsertRequired checks if the newly reported data matches the saved state, or needs to be updated
type DaprHostMemberStateConfig ¶
type DaprHostMemberStateConfig struct {
// contains filtered or unexported fields
}
DaprHostMemberStateConfig contains the placement cluster configuration data that needs to be consistent across leader changes
type DaprHostMemberStateData ¶
type DaprHostMemberStateData struct { // Index is the index number of raft log. Index uint64 // Version of the actor APIs for the cluster APILevel uint32 // TableGeneration is the generation of hashingTableMap. // This is increased whenever hashingTableMap is updated. TableGeneration uint64 Namespace map[string]*daprNamespace }
DaprHostMemberStateData is the state that stores Dapr namespace, runtime host and consistent hashing tables data
type FSM ¶
type FSM struct {
// contains filtered or unexported fields
}
FSM implements a finite state machine that is used along with Raft to provide strong consistency. We implement this outside the Server to avoid exposing it outside the package.
func (*FSM) PlacementState ¶
func (c *FSM) PlacementState(withVirtualNodes bool, namespace string) *v1pb.PlacementTables
PlacementState returns the current placement tables. the withVirtualNodes parameter is here for backwards compatibility and should be removed in 1.15 TODO in v1.15 remove the withVirtualNodes parameter
func (*FSM) Restore ¶
func (c *FSM) Restore(old io.ReadCloser) error
Restore streams in the snapshot and replaces the current state store with a new one based on the snapshot if all goes OK during the restore.
func (*FSM) Snapshot ¶
func (c *FSM) Snapshot() (raft.FSMSnapshot, error)
Snapshot is used to support log compaction. This call should return an FSMSnapshot which can be used to save a point-in-time snapshot of the FSM.
func (*FSM) State ¶
func (c *FSM) State() *DaprHostMemberState
State is used to return a handle to the current state.
type Server ¶
type Server struct {
// contains filtered or unexported fields
}
Server is Raft server implementation.
func (*Server) ApplyCommand ¶
func (s *Server) ApplyCommand(cmdType CommandType, data DaprHostMember) (bool, error)
ApplyCommand applies command log to state machine to upsert or remove members.