Documentation
¶
Index ¶
- Constants
- Variables
- type Connector
- type CopyCommandState
- type Courier
- func (e *Courier) CacheReply(reply *commands.ReplicaMessageReply)
- func (e *Courier) HandleReply(reply *commands.ReplicaMessageReply)
- func (e *Courier) OnCommand(cmd cborplugin.Command) error
- func (e *Courier) RegisterConsumer(s *cborplugin.Server)
- func (e *Courier) SetWriteFunc(writeFunc func(cborplugin.Command))
- type CourierBookKeeping
- type GenericConnector
- type PKIWorker
- func (p *PKIWorker) AuthenticateReplicaConnection(c *wire.PeerCredentials) (*pki.ReplicaDescriptor, bool)
- func (p *PKIWorker) ForceFetchPKI() error
- func (p *PKIWorker) HasCurrentPKIDocument() bool
- func (p *PKIWorker) ReplicasCopy() map[[32]byte]*pki.ReplicaDescriptor
- func (p *PKIWorker) SetDocumentForEpoch(epoch uint64, doc *pki.Document, rawDoc []byte)
- type Server
Constants ¶
const CopyDedupCacheTTL = 30 * time.Minute
CopyDedupCacheTTL bounds how long a completed Copy command's status stays retrievable by the client via polling. Long enough to cover a reconnecting client that missed earlier polls, short enough that the cache stays bounded in memory.
const DedupCacheTTL = 5 * time.Minute
DedupCacheTTL bounds how long a CourierBookKeeping entry stays in dedupCache. Long enough to cover an active ARQ retry cycle for a single envelope, short enough that dedupCache size stays bounded under load.
const KeepAliveInterval = 3 * time.Minute
const NumPKIDocsToFetch = 3
const ValidCourierEnvelopeEpochWindow uint64 = 1
ValidCourierEnvelopeEpochWindow is the symmetric tolerance applied to a CourierEnvelope's declared replica epoch. The courier accepts envelopes whose epoch falls within [current - window, current + window] where "current" is the courier's view of the current replica epoch.
A window of 1 means three acceptable epochs at any moment: {current-1, current, current+1}. See the Pigeonhole specification section "Epoch tolerance for CourierEnvelope" for the reasoning.
Variables ¶
var (
PublishDeadline = vServer.PublishConsensusDeadline
)
Functions ¶
This section is empty.
Types ¶
type Connector ¶
func (*Connector) CloseAllCh ¶
func (co *Connector) CloseAllCh() chan interface{}
func (*Connector) DispatchMessage ¶
func (co *Connector) DispatchMessage(dest uint8, message *commands.ReplicaMessage) error
func (*Connector) ForceUpdate ¶
func (co *Connector) ForceUpdate()
func (*Connector) OnClosedConn ¶
func (co *Connector) OnClosedConn(c *outgoingConn)
type CopyCommandState ¶ added in v0.0.73
type CopyCommandState struct {
InProgress bool
Done chan struct{} // Closed when the copy command completes
Result *pigeonhole.CourierQueryReply // Cached result (nil if still in progress)
CompletedAt time.Time // When the copy command completed
}
CopyCommandState tracks the state of a copy command for idempotency. This allows copy commands to be safely retried via ARQ without duplicating work.
type Courier ¶
type Courier struct {
// contains filtered or unexported fields
}
Courier handles the CBOR plugin interface for our courier service.
func NewCourier ¶
NewCourier returns a new Courier type.
func (*Courier) CacheReply ¶
func (e *Courier) CacheReply(reply *commands.ReplicaMessageReply)
func (*Courier) HandleReply ¶
func (e *Courier) HandleReply(reply *commands.ReplicaMessageReply)
func (*Courier) OnCommand ¶
func (e *Courier) OnCommand(cmd cborplugin.Command) error
OnCommand is only called when we receive queries from the client via the mixnet
func (*Courier) RegisterConsumer ¶
func (e *Courier) RegisterConsumer(s *cborplugin.Server)
func (*Courier) SetWriteFunc ¶
func (e *Courier) SetWriteFunc(writeFunc func(cborplugin.Command))
type CourierBookKeeping ¶
type CourierBookKeeping struct {
Epoch uint64
CreatedAt time.Time
QueryType uint8
IntermediateReplicas [2]uint8 // Store the replica IDs that were contacted
EnvelopeReplies [2]*commands.ReplicaMessageReply
}
CourierBookKeeping is used for: 1. deduping writes 2. deduping reads 3. caching replica replies
type GenericConnector ¶
type GenericConnector interface {
Halt()
Server() *Server
OnClosedConn(conn *outgoingConn)
CloseAllCh() chan interface{}
ForceUpdate()
DispatchMessage(dest uint8, message *commands.ReplicaMessage) error
}
type PKIWorker ¶
type PKIWorker struct {
worker.Worker
*pki.WorkerBase
// contains filtered or unexported fields
}
func (*PKIWorker) AuthenticateReplicaConnection ¶
func (p *PKIWorker) AuthenticateReplicaConnection(c *wire.PeerCredentials) (*pki.ReplicaDescriptor, bool)
func (*PKIWorker) ForceFetchPKI ¶
ForceFetchPKI forces the PKI worker to fetch a new PKI document for the current epoch. This is useful for integration tests where you want to ensure the courier has the latest PKI document without waiting for the normal fetch cycle.
func (*PKIWorker) HasCurrentPKIDocument ¶
HasCurrentPKIDocument returns true if the courier has a PKI document for the current epoch. This is useful for integration tests to check if the courier is ready.
func (*PKIWorker) ReplicasCopy ¶
func (p *PKIWorker) ReplicasCopy() map[[32]byte]*pki.ReplicaDescriptor
type Server ¶
func NewWithDefaultPKI ¶
NewWithDefaultPKI creates a new Server with the default voting PKI client
func NewWithPKI ¶
NewWithPKI creates a new Server with a custom PKI client for testing
func (*Server) ForceConnectorUpdate ¶
func (s *Server) ForceConnectorUpdate()
func (*Server) IdentityPublicKey ¶
IdentityPublicKey returns the server's identity public key
func (*Server) LinkPublicKey ¶
LinkPublicKey returns the server's link public key
func (*Server) LogBackend ¶
func (*Server) SendMessage ¶
func (s *Server) SendMessage(dest uint8, mesg *commands.ReplicaMessage) error
func (*Server) StartPlugin ¶
func (s *Server) StartPlugin()
StartPlugin starts the CBOR plugin service which listens for socket connections from the service node.