Documentation
¶
Index ¶
- type ChainsyncClientState
- type State
- func (s *State) AddClient(connId connection.ConnectionId, intersectPoint ocommon.Point) (*ChainsyncClientState, error)
- func (s *State) AddClientConnId(connId ouroboros.ConnectionId)
- func (s *State) ClientConnCount() int
- func (s *State) GetClientConnId() *ouroboros.ConnectionId
- func (s *State) GetClientConnIds() []ouroboros.ConnectionId
- func (s *State) HasClientConnId(connId ouroboros.ConnectionId) bool
- func (s *State) RemoveClient(connId connection.ConnectionId)
- func (s *State) RemoveClientConnId(connId ouroboros.ConnectionId)
- func (s *State) SetClientConnId(connId ouroboros.ConnectionId)
- func (s *State) TryAddClientConnId(connId ouroboros.ConnectionId, maxClients int) bool
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type ChainsyncClientState ¶
type ChainsyncClientState struct {
ChainIter *chain.ChainIterator
Cursor ocommon.Point
NeedsInitialRollback bool
}
type State ¶
func (*State) AddClient ¶
func (s *State) AddClient( connId connection.ConnectionId, intersectPoint ocommon.Point, ) (*ChainsyncClientState, error)
func (*State) AddClientConnId ¶ added in v0.21.0
func (s *State) AddClientConnId(connId ouroboros.ConnectionId)
AddClientConnId adds a connection ID to the set of tracked chainsync clients. If no active client exists, this connection is automatically set as the active client. This ensures there is always an active client when at least one is tracked.
func (*State) ClientConnCount ¶ added in v0.21.0
ClientConnCount returns the number of tracked chainsync clients.
func (*State) GetClientConnId ¶
func (s *State) GetClientConnId() *ouroboros.ConnectionId
GetClientConnId returns the active chainsync client connection ID. This is the connection that should be used for block fetching.
func (*State) GetClientConnIds ¶ added in v0.21.0
func (s *State) GetClientConnIds() []ouroboros.ConnectionId
GetClientConnIds returns all tracked chainsync client connection IDs.
func (*State) HasClientConnId ¶ added in v0.21.0
func (s *State) HasClientConnId(connId ouroboros.ConnectionId) bool
HasClientConnId returns true if the connection ID is being tracked.
func (*State) RemoveClient ¶
func (s *State) RemoveClient(connId connection.ConnectionId)
func (*State) RemoveClientConnId ¶
func (s *State) RemoveClientConnId(connId ouroboros.ConnectionId)
RemoveClientConnId removes a connection from tracking. If this was the active client, selects a fallback from remaining tracked clients.
func (*State) SetClientConnId ¶
func (s *State) SetClientConnId(connId ouroboros.ConnectionId)
SetClientConnId sets the active chainsync client connection ID. This is used when chain selection determines a new best peer.
func (*State) TryAddClientConnId ¶ added in v0.21.0
func (s *State) TryAddClientConnId( connId ouroboros.ConnectionId, maxClients int, ) bool
TryAddClientConnId atomically checks if a connection can be added (not already tracked and under maxClients limit) and adds it if allowed. Returns true if the connection was added, false otherwise.