isaacnetwork

package
v0.0.2-alpha Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: May 30, 2023 License: GPL-3.0 Imports: 34 Imported by: 28

Documentation

Overview

Package isaacnetwork provides network.

Index

Constants

This section is empty.

Variables

View Source
var (
	HandlerPrefixRequestProposal        = "request_proposal"
	HandlerPrefixProposal               = "proposal"
	HandlerPrefixLastSuffrageProof      = "last_suffrage_proof"
	HandlerPrefixSuffrageProof          = "suffrage_proof"
	HandlerPrefixLastBlockMap           = "last_blockmap"
	HandlerPrefixBlockMap               = "blockmap"
	HandlerPrefixBlockMapItem           = "blockmap_item"
	HandlerPrefixMemberlist             = "memberlist"
	HandlerPrefixNodeChallenge          = "node_challenge"
	HandlerPrefixSuffrageNodeConnInfo   = "suffrage_node_conninfo"
	HandlerPrefixSyncSourceConnInfo     = "sync_source_conninfo"
	HandlerPrefixOperation              = "operation"
	HandlerPrefixSendOperation          = "send_operation"
	HandlerPrefixState                  = "state"
	HandlerPrefixExistsInStateOperation = "exists_instate_operation"
	HandlerPrefixNodeInfo               = "node_info"
	HandlerPrefixCallbackMessage        = "callback_message"
	HandlerPrefixSendBallots            = "send_ballots"
)
View Source
var (
	OperationRequestHeaderHint              = hint.MustNewHint("operation-header-v0.0.1")
	SendOperationRequestHeaderHint          = hint.MustNewHint("send-operation-header-v0.0.1")
	RequestProposalRequestHeaderHint        = hint.MustNewHint("request-proposal-header-v0.0.1")
	ProposalRequestHeaderHint               = hint.MustNewHint("proposal-header-v0.0.1")
	LastSuffrageProofRequestHeaderHint      = hint.MustNewHint("last-suffrage-proof-header-v0.0.1")
	SuffrageProofRequestHeaderHint          = hint.MustNewHint("suffrage-proof-header-v0.0.1")
	LastBlockMapRequestHeaderHint           = hint.MustNewHint("last-blockmap-header-v0.0.1")
	BlockMapRequestHeaderHint               = hint.MustNewHint("blockmap-header-v0.0.1")
	BlockMapItemRequestHeaderHint           = hint.MustNewHint("blockmap-item-header-v0.0.1")
	NodeChallengeRequestHeaderHint          = hint.MustNewHint("node-challenge-header-v0.0.1")
	SuffrageNodeConnInfoRequestHeaderHint   = hint.MustNewHint("suffrage-node-conninfo-header-v0.0.1")
	SyncSourceConnInfoRequestHeaderHint     = hint.MustNewHint("sync-source-conninfo-header-v0.0.1")
	StateRequestHeaderHint                  = hint.MustNewHint("state-header-v0.0.1")
	ExistsInStateOperationRequestHeaderHint = hint.MustNewHint("exists-instate-operation-header-v0.0.1")
	NodeInfoRequestHeaderHint               = hint.MustNewHint("node-info-header-v0.0.1")
	CallbackMessageHeaderHint               = hint.MustNewHint("callback-message-header-v0.0.1")
	SendBallotsHeaderHint                   = hint.MustNewHint("send-ballots-header-v0.0.1")
)
View Source
var CallbackBroadcastMessageHint = hint.MustNewHint("callback-broadcast-message-v0.0.1")
View Source
var NodeConnInfoHint = hint.MustNewHint("node-conninfo-v0.0.1")
View Source
var NodeInfoHint = hint.MustNewHint("node-info-v0.0.1")
View Source
var ResponseHeaderHint = hint.MustNewHint("response-header-v0.0.1")

Functions

func ClientWrite

func ClientWrite(w io.Writer, prefix string, enchint hint.Hint, header []byte, body io.Reader) error

func HandlerReadHead

func HandlerReadHead(ctx context.Context, encs *encoder.Encoders, r io.Reader) (encoder.Encoder, []byte, error)

func QuicstreamErrorHandler

func QuicstreamErrorHandler(enc encoder.Encoder) quicstream.ErrorHandler

func QuicstreamHandlerBlockMap

func QuicstreamHandlerBlockMap(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	blockMapf func(base.Height) (hint.Hint, []byte, []byte, bool, error),
) quicstream.Handler

func QuicstreamHandlerBlockMapItem

func QuicstreamHandlerBlockMapItem(
	encs *encoder.Encoders,
	idleTimeout,
	writeTimeout time.Duration,
	blockMapItemf func(base.Height, base.BlockMapItemType) (io.ReadCloser, bool, error),
) quicstream.Handler

func QuicstreamHandlerCallbackMessage

func QuicstreamHandlerCallbackMessage(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	cb *CallbackBroadcaster,
) quicstream.Handler

func QuicstreamHandlerExistsInStateOperation

func QuicstreamHandlerExistsInStateOperation(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	existsInStateOperationf func(util.Hash) (bool, error),
) quicstream.Handler

func QuicstreamHandlerLastBlockMap

func QuicstreamHandlerLastBlockMap(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	lastBlockMapf func(util.Hash) (hint.Hint, []byte, []byte, bool, error),
) quicstream.Handler

LastBlockMap responds the last BlockMap to client; if there is no BlockMap, it returns nil BlockMap and not updated without error.

func QuicstreamHandlerLastSuffrageProof

func QuicstreamHandlerLastSuffrageProof(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	lastSuffrageProoff func(suffragestate util.Hash) (hint.Hint, []byte, []byte, bool, error),
) quicstream.Handler

func QuicstreamHandlerNodeChallenge

func QuicstreamHandlerNodeChallenge(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	local base.LocalNode,
	params base.LocalParams,
) quicstream.Handler

func QuicstreamHandlerNodeInfo

func QuicstreamHandlerNodeInfo(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	getNodeInfo func() ([]byte, error),
) quicstream.Handler

func QuicstreamHandlerOperation

func QuicstreamHandlerOperation(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	oppool isaac.NewOperationPool,
) quicstream.Handler

func QuicstreamHandlerProposal

func QuicstreamHandlerProposal(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	pool isaac.ProposalPool,
) quicstream.Handler

func QuicstreamHandlerRequestProposal

func QuicstreamHandlerRequestProposal(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	local base.LocalNode,
	pool isaac.ProposalPool,
	proposalMaker *isaac.ProposalMaker,
	lastBlockMapf func() (base.BlockMap, bool, error),
) quicstream.Handler

func QuicstreamHandlerSendBallots

func QuicstreamHandlerSendBallots(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	params *isaac.LocalParams,
	votef func(base.BallotSignFact) error,
) quicstream.Handler

func QuicstreamHandlerSendOperation

func QuicstreamHandlerSendOperation(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	params *isaac.LocalParams,
	oppool isaac.NewOperationPool,
	existsInStateOperationf func(util.Hash) (bool, error),
	filterSendOperationf func(base.Operation) (bool, error),
	svvote isaac.SuffrageVoteFunc,
	broadcast func(string, []byte) error,
) quicstream.Handler

func QuicstreamHandlerState

func QuicstreamHandlerState(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	statef func(string) (enchint hint.Hint, meta, body []byte, found bool, err error),
) quicstream.Handler

func QuicstreamHandlerSuffrageNodeConnInfo

func QuicstreamHandlerSuffrageNodeConnInfo(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	suffrageNodeConnInfof func() ([]isaac.NodeConnInfo, error),
) quicstream.Handler

func QuicstreamHandlerSuffrageProof

func QuicstreamHandlerSuffrageProof(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	suffrageProoff func(base.Height) (hint.Hint, []byte, []byte, bool, error),
) quicstream.Handler

func QuicstreamHandlerSyncSourceConnInfo

func QuicstreamHandlerSyncSourceConnInfo(
	encs *encoder.Encoders,
	idleTimeout time.Duration,
	syncSourceConnInfof func() ([]isaac.NodeConnInfo, error),
) quicstream.Handler

func ReadEncoder

func ReadEncoder(ctx context.Context, encs *encoder.Encoders, r io.Reader) (encoder.Encoder, error)

func WriteResponse

func WriteResponse(w io.Writer, header isaac.NetworkHeader, body interface{}, enc encoder.Encoder) error

func WriteResponseBytes

func WriteResponseBytes(w io.Writer, header isaac.NetworkHeader, body []byte, enc encoder.Encoder) error

Types

type BaseHeader

type BaseHeader struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func NewBaseHeader

func NewBaseHeader(ht hint.Hint) BaseHeader

func (BaseHeader) HandlerPrefix

func (h BaseHeader) HandlerPrefix() string

type BaseNetworkClient

type BaseNetworkClient struct {
	// contains filtered or unexported fields
}

func NewBaseNetworkClient

func NewBaseNetworkClient(
	encs *encoder.Encoders,
	enc encoder.Encoder,
	idleTimeout time.Duration,
	writef BaseNetworkClientWriteFunc,
) *BaseNetworkClient

func (*BaseNetworkClient) BlockMap

func (*BaseNetworkClient) BlockMapItem

func (c *BaseNetworkClient) BlockMapItem(
	ctx context.Context, ci quicstream.UDPConnInfo, height base.Height, item base.BlockMapItemType,
) (_ io.ReadCloser, cancel func() error, found bool, _ error)

func (*BaseNetworkClient) ExistsInStateOperation

func (c *BaseNetworkClient) ExistsInStateOperation(
	ctx context.Context, ci quicstream.UDPConnInfo, facthash util.Hash,
) (bool, error)

func (*BaseNetworkClient) LastBlockMap

func (c *BaseNetworkClient) LastBlockMap(
	ctx context.Context, ci quicstream.UDPConnInfo, manifest util.Hash,
) (base.BlockMap, bool, error)

func (*BaseNetworkClient) LastSuffrageProof

func (c *BaseNetworkClient) LastSuffrageProof(
	ctx context.Context, ci quicstream.UDPConnInfo, state util.Hash,
) (base.Height, base.SuffrageProof, bool, error)

func (*BaseNetworkClient) NewClient

func (c *BaseNetworkClient) NewClient() *BaseNetworkClient

func (*BaseNetworkClient) NodeChallenge

func (c *BaseNetworkClient) NodeChallenge(
	ctx context.Context, ci quicstream.UDPConnInfo,
	networkID base.NetworkID,
	node base.Address, pub base.Publickey, input []byte,
) (base.Signature, error)

func (*BaseNetworkClient) Operation

func (c *BaseNetworkClient) Operation(
	ctx context.Context, ci quicstream.UDPConnInfo, operationhash util.Hash,
) (base.Operation, bool, error)

func (*BaseNetworkClient) Proposal

func (*BaseNetworkClient) Request

func (c *BaseNetworkClient) Request(
	ctx context.Context,
	ci quicstream.UDPConnInfo,
	header isaac.NetworkHeader,
	body io.Reader,
) (
	_ isaac.NetworkResponseHeader,
	_ interface{},
	cancel func() error,
	_ error,
)

func (*BaseNetworkClient) RequestProposal

func (c *BaseNetworkClient) RequestProposal(
	ctx context.Context,
	ci quicstream.UDPConnInfo,
	point base.Point,
	proposer base.Address,
) (base.ProposalSignFact, bool, error)

func (*BaseNetworkClient) SendBallots

func (c *BaseNetworkClient) SendBallots(
	ctx context.Context,
	ci quicstream.UDPConnInfo,
	ballots []base.BallotSignFact,
) error

func (*BaseNetworkClient) SendOperation

func (c *BaseNetworkClient) SendOperation(
	ctx context.Context,
	ci quicstream.UDPConnInfo,
	op base.Operation,
) (bool, error)

func (*BaseNetworkClient) State

func (*BaseNetworkClient) SuffrageNodeConnInfo

func (c *BaseNetworkClient) SuffrageNodeConnInfo(
	ctx context.Context, ci quicstream.UDPConnInfo,
) ([]isaac.NodeConnInfo, error)

func (*BaseNetworkClient) SuffrageProof

func (c *BaseNetworkClient) SuffrageProof(
	ctx context.Context, ci quicstream.UDPConnInfo, suffrageheight base.Height,
) (base.SuffrageProof, bool, error)

func (*BaseNetworkClient) SyncSourceConnInfo

func (c *BaseNetworkClient) SyncSourceConnInfo(
	ctx context.Context, ci quicstream.UDPConnInfo,
) ([]isaac.NodeConnInfo, error)

type BaseNetworkClientWriteFunc

type BaseNetworkClientWriteFunc func(
	ctx context.Context,
	conninfo quicstream.UDPConnInfo,
	writef quicstream.ClientWriteFunc,
) (_ io.ReadCloser, cancel func() error, _ error)

type BlockMapItemRequestHeader

type BlockMapItemRequestHeader struct {
	BaseHeader
	// contains filtered or unexported fields
}

func NewBlockMapItemRequestHeader

func NewBlockMapItemRequestHeader(height base.Height, item base.BlockMapItemType) BlockMapItemRequestHeader

func (BlockMapItemRequestHeader) Height

func (BlockMapItemRequestHeader) IsValid

func (h BlockMapItemRequestHeader) IsValid([]byte) error

func (BlockMapItemRequestHeader) Item

func (BlockMapItemRequestHeader) MarshalJSON

func (h BlockMapItemRequestHeader) MarshalJSON() ([]byte, error)

func (*BlockMapItemRequestHeader) UnmarshalJSON

func (h *BlockMapItemRequestHeader) UnmarshalJSON(b []byte) error

type BlockMapItemRequestHeaderJSONMarshaler

type BlockMapItemRequestHeaderJSONMarshaler struct {
	Item   base.BlockMapItemType `json:"item"`
	Height base.Height           `json:"height"`
}

type BlockMapItemRequestHeaderJSONUnmarshaler

type BlockMapItemRequestHeaderJSONUnmarshaler struct {
	Item   base.BlockMapItemType `json:"item"`
	Height base.Height           `json:"height"`
}

type BlockMapRequestHeader

type BlockMapRequestHeader struct {
	BaseHeader
	// contains filtered or unexported fields
}

func NewBlockMapRequestHeader

func NewBlockMapRequestHeader(height base.Height) BlockMapRequestHeader

func (BlockMapRequestHeader) Height

func (h BlockMapRequestHeader) Height() base.Height

func (BlockMapRequestHeader) IsValid

func (h BlockMapRequestHeader) IsValid([]byte) error

func (BlockMapRequestHeader) MarshalJSON

func (h BlockMapRequestHeader) MarshalJSON() ([]byte, error)

func (*BlockMapRequestHeader) UnmarshalJSON

func (h *BlockMapRequestHeader) UnmarshalJSON(b []byte) error

type BlockMapRequestHeaderJSONMarshaler

type BlockMapRequestHeaderJSONMarshaler struct {
	Height base.Height `json:"height"`
}

type BlockMapRequestHeaderJSONUnmarshaler

type BlockMapRequestHeaderJSONUnmarshaler struct {
	Height base.Height `json:"height"`
}

type CallbackBroadcastMessage

type CallbackBroadcastMessage struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func (CallbackBroadcastMessage) ConnInfo

func (CallbackBroadcastMessage) ID

func (CallbackBroadcastMessage) IsValid

func (m CallbackBroadcastMessage) IsValid([]byte) error

func (CallbackBroadcastMessage) MarshalJSON

func (m CallbackBroadcastMessage) MarshalJSON() ([]byte, error)

func (*CallbackBroadcastMessage) UnmarshalJSON

func (m *CallbackBroadcastMessage) UnmarshalJSON(b []byte) error

type CallbackBroadcaster

type CallbackBroadcaster struct {
	// contains filtered or unexported fields
}

func (*CallbackBroadcaster) Broadcast

func (c *CallbackBroadcaster) Broadcast(id string, b []byte, notifych chan struct{}) error

func (*CallbackBroadcaster) RawMessage

func (c *CallbackBroadcaster) RawMessage(id string) ([]byte, bool)

type CallbackMessageHeader

type CallbackMessageHeader struct {
	BaseHeader
	// contains filtered or unexported fields
}

func NewCallbackMessageHeader

func NewCallbackMessageHeader(id string) CallbackMessageHeader

func (*CallbackMessageHeader) DecodeJSON

func (h *CallbackMessageHeader) DecodeJSON(b []byte, _ *jsonenc.Encoder) error

func (CallbackMessageHeader) ID

func (CallbackMessageHeader) IsValid

func (h CallbackMessageHeader) IsValid([]byte) error

func (CallbackMessageHeader) MarshalJSON

func (h CallbackMessageHeader) MarshalJSON() ([]byte, error)

type ExistsInStateOperationRequestHeader

type ExistsInStateOperationRequestHeader struct {
	BaseHeader
	// contains filtered or unexported fields
}

func NewExistsInStateOperationRequestHeader

func NewExistsInStateOperationRequestHeader(facthash util.Hash) ExistsInStateOperationRequestHeader

func (ExistsInStateOperationRequestHeader) FactHash

func (ExistsInStateOperationRequestHeader) IsValid

func (ExistsInStateOperationRequestHeader) MarshalJSON

func (h ExistsInStateOperationRequestHeader) MarshalJSON() ([]byte, error)

func (*ExistsInStateOperationRequestHeader) UnmarshalJSON

func (h *ExistsInStateOperationRequestHeader) UnmarshalJSON(b []byte) error

type LastBlockMapRequestHeader

type LastBlockMapRequestHeader struct {
	BaseHeader
	// contains filtered or unexported fields
}

func NewLastBlockMapRequestHeader

func NewLastBlockMapRequestHeader(manifest util.Hash) LastBlockMapRequestHeader

func (LastBlockMapRequestHeader) IsValid

func (h LastBlockMapRequestHeader) IsValid([]byte) error

func (LastBlockMapRequestHeader) Manifest

func (h LastBlockMapRequestHeader) Manifest() util.Hash

func (LastBlockMapRequestHeader) MarshalJSON

func (h LastBlockMapRequestHeader) MarshalJSON() ([]byte, error)

func (*LastBlockMapRequestHeader) UnmarshalJSON

func (h *LastBlockMapRequestHeader) UnmarshalJSON(b []byte) error

type LastSuffrageProofRequestHeader

type LastSuffrageProofRequestHeader struct {
	BaseHeader
	// contains filtered or unexported fields
}

func NewLastSuffrageProofRequestHeader

func NewLastSuffrageProofRequestHeader(state util.Hash) LastSuffrageProofRequestHeader

func (LastSuffrageProofRequestHeader) IsValid

func (LastSuffrageProofRequestHeader) MarshalJSON

func (h LastSuffrageProofRequestHeader) MarshalJSON() ([]byte, error)

func (LastSuffrageProofRequestHeader) State

func (*LastSuffrageProofRequestHeader) UnmarshalJSON

func (h *LastSuffrageProofRequestHeader) UnmarshalJSON(b []byte) error

type NodeChallengeRequestHeader

type NodeChallengeRequestHeader struct {
	BaseHeader
	// contains filtered or unexported fields
}

func NewNodeChallengeRequestHeader

func NewNodeChallengeRequestHeader(input []byte) NodeChallengeRequestHeader

func (NodeChallengeRequestHeader) Input

func (h NodeChallengeRequestHeader) Input() []byte

func (NodeChallengeRequestHeader) IsValid

func (h NodeChallengeRequestHeader) IsValid([]byte) error

func (NodeChallengeRequestHeader) MarshalJSON

func (h NodeChallengeRequestHeader) MarshalJSON() ([]byte, error)

func (*NodeChallengeRequestHeader) UnmarshalJSON

func (h *NodeChallengeRequestHeader) UnmarshalJSON(b []byte) error

type NodeChallengeRequestHeaderJSONMarshaler

type NodeChallengeRequestHeaderJSONMarshaler struct {
	Input []byte `json:"input"`
}

type NodeConnInfo

type NodeConnInfo struct {
	quicmemberlist.NamedConnInfo
	base.BaseNode
}

func NewNodeConnInfo

func NewNodeConnInfo(node base.BaseNode, addr string, tlsinsecure bool) NodeConnInfo

func NewNodeConnInfoFromMemberlistNode

func NewNodeConnInfoFromMemberlistNode(node quicmemberlist.Node) NodeConnInfo

func (*NodeConnInfo) DecodeJSON

func (n *NodeConnInfo) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (NodeConnInfo) IsValid

func (n NodeConnInfo) IsValid([]byte) error

func (NodeConnInfo) MarshalJSON

func (n NodeConnInfo) MarshalJSON() ([]byte, error)

type NodeInfo

type NodeInfo struct {
	hint.BaseHinter
	// contains filtered or unexported fields
}

func (NodeInfo) Address

func (info NodeInfo) Address() base.Address

func (NodeInfo) ConnInfo

func (info NodeInfo) ConnInfo() string

func (NodeInfo) ConsensusNodes

func (info NodeInfo) ConsensusNodes() []base.Node

func (NodeInfo) ConsensusState

func (info NodeInfo) ConsensusState() string

func (*NodeInfo) DecodeJSON

func (info *NodeInfo) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (NodeInfo) IsValid

func (info NodeInfo) IsValid(networkID base.NetworkID) error

func (NodeInfo) JSONMarshaler

func (info NodeInfo) JSONMarshaler() NodeInfoJSONMarshaler

func (NodeInfo) LastManifest

func (info NodeInfo) LastManifest() base.Manifest

func (NodeInfo) LocalParams

func (info NodeInfo) LocalParams() *isaac.LocalParams

func (NodeInfo) MarshalJSON

func (info NodeInfo) MarshalJSON() ([]byte, error)

func (NodeInfo) NetworkPolicy

func (info NodeInfo) NetworkPolicy() base.NetworkPolicy

func (NodeInfo) Publickey

func (info NodeInfo) Publickey() base.Publickey

func (NodeInfo) SuffrageHeight

func (info NodeInfo) SuffrageHeight() base.Height

func (NodeInfo) Version

func (info NodeInfo) Version() util.Version

type NodeInfoConsensusJSONMarshaler

type NodeInfoConsensusJSONMarshaler struct {
	State    isaacstates.StateType         `json:"state"`
	Suffrage NodeInfoSuffrageJSONMarshaler `json:"suffrage"`
}

type NodeInfoJSONMarshaler

type NodeInfoJSONMarshaler struct {
	NetworkID     base.NetworkID                 `json:"network_id"`
	LastManifest  base.Manifest                  `json:"last_manifest"`
	NetworkPolicy base.NetworkPolicy             `json:"network_policy"`
	Local         NodeInfoLocalJSONMarshaler     `json:"local"`
	Consensus     NodeInfoConsensusJSONMarshaler `json:"consensus"`
	hint.BaseHinter
}

type NodeInfoLocalJSONMarshaler

type NodeInfoLocalJSONMarshaler struct {
	Address     base.Address       `json:"address"`
	Publickey   base.Publickey     `json:"publickey"`
	LocalParams *isaac.LocalParams `json:"parameters"` //nolint:tagliatelle //...
	ConnInfo    string             `json:"conn_info"`
	Uptime      string             `json:"uptime"`
	Version     util.Version       `json:"version"`
}

type NodeInfoRequestHeader

type NodeInfoRequestHeader struct {
	BaseHeader
}

func NewNodeInfoRequestHeader

func NewNodeInfoRequestHeader() NodeInfoRequestHeader

func (NodeInfoRequestHeader) IsValid

func (h NodeInfoRequestHeader) IsValid([]byte) error

func (*NodeInfoRequestHeader) UnmarshalJSON

func (h *NodeInfoRequestHeader) UnmarshalJSON(b []byte) error

type NodeInfoSuffrageJSONMarshaler

type NodeInfoSuffrageJSONMarshaler struct {
	Nodes  []base.Node `json:"nodes"`
	Height base.Height `json:"height"`
}

type NodeInfoUpdater

type NodeInfoUpdater struct {
	sync.RWMutex
	// contains filtered or unexported fields
}

func NewNodeInfoUpdater

func NewNodeInfoUpdater(networkID base.NetworkID, local base.Node, version util.Version) *NodeInfoUpdater

func (*NodeInfoUpdater) ID

func (info *NodeInfoUpdater) ID() string

func (*NodeInfoUpdater) NodeInfo

func (info *NodeInfoUpdater) NodeInfo() NodeInfo

func (*NodeInfoUpdater) SetConnInfo

func (info *NodeInfoUpdater) SetConnInfo(c string) bool

func (*NodeInfoUpdater) SetConsensusNodes

func (info *NodeInfoUpdater) SetConsensusNodes(nodes []base.Node) bool

func (*NodeInfoUpdater) SetConsensusState

func (info *NodeInfoUpdater) SetConsensusState(s isaacstates.StateType) bool

func (*NodeInfoUpdater) SetLastManifest

func (info *NodeInfoUpdater) SetLastManifest(m base.Manifest) bool

func (*NodeInfoUpdater) SetLocalParams

func (info *NodeInfoUpdater) SetLocalParams(p *isaac.LocalParams) bool

func (*NodeInfoUpdater) SetNetworkPolicy

func (info *NodeInfoUpdater) SetNetworkPolicy(p base.NetworkPolicy) bool

func (*NodeInfoUpdater) SetSuffrageHeight

func (info *NodeInfoUpdater) SetSuffrageHeight(h base.Height) bool

func (*NodeInfoUpdater) StartedAt

func (info *NodeInfoUpdater) StartedAt() time.Time

type NodeSignBroadcast

type NodeSignBroadcast struct {
	base.BaseNodeSign
	// contains filtered or unexported fields
}

func NewNodeSignBroadcast

func NewNodeSignBroadcast(b []byte) NodeSignBroadcast

func (NodeSignBroadcast) Body

func (m NodeSignBroadcast) Body() []byte

func (*NodeSignBroadcast) NodeSign

func (m *NodeSignBroadcast) NodeSign(priv base.Privatekey, networkID base.NetworkID, node base.Address) error

type OperationRequestHeader

type OperationRequestHeader struct {
	BaseHeader
	// contains filtered or unexported fields
}

func NewOperationRequestHeader

func NewOperationRequestHeader(operationhash util.Hash) OperationRequestHeader

func (*OperationRequestHeader) DecodeJSON

func (h *OperationRequestHeader) DecodeJSON(b []byte, _ *jsonenc.Encoder) error

func (OperationRequestHeader) IsValid

func (h OperationRequestHeader) IsValid([]byte) error

func (OperationRequestHeader) MarshalJSON

func (h OperationRequestHeader) MarshalJSON() ([]byte, error)

func (OperationRequestHeader) Operation

func (h OperationRequestHeader) Operation() util.Hash

type ProposalRequestHeader

type ProposalRequestHeader struct {
	BaseHeader
	// contains filtered or unexported fields
}

func NewProposalRequestHeader

func NewProposalRequestHeader(proposal util.Hash) ProposalRequestHeader

func (ProposalRequestHeader) IsValid

func (h ProposalRequestHeader) IsValid([]byte) error

func (ProposalRequestHeader) MarshalJSON

func (h ProposalRequestHeader) MarshalJSON() ([]byte, error)

func (ProposalRequestHeader) Proposal

func (h ProposalRequestHeader) Proposal() util.Hash

func (*ProposalRequestHeader) UnmarshalJSON

func (h *ProposalRequestHeader) UnmarshalJSON(b []byte) error

type QuicstreamClient

type QuicstreamClient struct {
	*BaseNetworkClient
	// contains filtered or unexported fields
}

func NewQuicstreamClient

func NewQuicstreamClient(
	encs *encoder.Encoders,
	enc encoder.Encoder,
	idleTimeout time.Duration,
	proto string,
	quicconfig *quic.Config,
) *QuicstreamClient

func (*QuicstreamClient) Clone

func (c *QuicstreamClient) Clone() *QuicstreamClient

func (*QuicstreamClient) Close

func (c *QuicstreamClient) Close() error

func (*QuicstreamClient) NewQuicstreamClient

func (c *QuicstreamClient) NewQuicstreamClient(
	ci quicstream.UDPConnInfo,
) func(*net.UDPAddr) *quicstream.Client

type RequestProposalRequestHeader

type RequestProposalRequestHeader struct {
	BaseHeader
	// contains filtered or unexported fields
}

func NewRequestProposalRequestHeader

func NewRequestProposalRequestHeader(point base.Point, proposer base.Address) RequestProposalRequestHeader

func (*RequestProposalRequestHeader) DecodeJSON

func (h *RequestProposalRequestHeader) DecodeJSON(b []byte, enc *jsonenc.Encoder) error

func (RequestProposalRequestHeader) IsValid

func (RequestProposalRequestHeader) MarshalJSON

func (h RequestProposalRequestHeader) MarshalJSON() ([]byte, error)

func (RequestProposalRequestHeader) Point

func (RequestProposalRequestHeader) Proposer

type ResponseHeader

type ResponseHeader struct {
	BaseHeader
	// contains filtered or unexported fields
}

func NewResponseHeader

func NewResponseHeader(ok bool, err error) ResponseHeader

func NewResponseHeaderWithType

func NewResponseHeaderWithType(ok bool, err error, ctype isaac.NetworkResponseContentType) ResponseHeader

func (ResponseHeader) Err

func (r ResponseHeader) Err() error

func (ResponseHeader) MarshalJSON

func (r ResponseHeader) MarshalJSON() ([]byte, error)

func (ResponseHeader) OK

func (r ResponseHeader) OK() bool

func (ResponseHeader) Type

func (*ResponseHeader) UnmarshalJSON

func (r *ResponseHeader) UnmarshalJSON(b []byte) error

type ResponseHeaderJSONMarshaler

type ResponseHeaderJSONMarshaler struct {
	Type  isaac.NetworkResponseContentType `json:"type,omitempty"`
	Error string                           `json:"error,omitempty"`
	OK    bool                             `json:"ok,omitempty"`
}

type SendBallotsHeader

type SendBallotsHeader struct {
	BaseHeader
}

func NewSendBallotsHeader

func NewSendBallotsHeader() SendBallotsHeader

func (SendBallotsHeader) IsValid

func (h SendBallotsHeader) IsValid([]byte) error

type SendOperationRequestHeader

type SendOperationRequestHeader struct {
	BaseHeader
}

func NewSendOperationRequestHeader

func NewSendOperationRequestHeader() SendOperationRequestHeader

func (SendOperationRequestHeader) IsValid

func (h SendOperationRequestHeader) IsValid([]byte) error

func (*SendOperationRequestHeader) UnmarshalJSON

func (h *SendOperationRequestHeader) UnmarshalJSON(b []byte) error

type StateRequestHeader

type StateRequestHeader struct {
	BaseHeader
	// contains filtered or unexported fields
}

func NewStateRequestHeader

func NewStateRequestHeader(key string, h util.Hash) StateRequestHeader

func (StateRequestHeader) Hash

func (h StateRequestHeader) Hash() util.Hash

func (StateRequestHeader) IsValid

func (h StateRequestHeader) IsValid([]byte) error

func (StateRequestHeader) Key

func (h StateRequestHeader) Key() string

func (StateRequestHeader) MarshalJSON

func (h StateRequestHeader) MarshalJSON() ([]byte, error)

func (*StateRequestHeader) UnmarshalJSON

func (h *StateRequestHeader) UnmarshalJSON(b []byte) error

type SuffrageNodeConnInfoRequestHeader

type SuffrageNodeConnInfoRequestHeader struct {
	BaseHeader
}

func NewSuffrageNodeConnInfoRequestHeader

func NewSuffrageNodeConnInfoRequestHeader() SuffrageNodeConnInfoRequestHeader

func (SuffrageNodeConnInfoRequestHeader) IsValid

func (*SuffrageNodeConnInfoRequestHeader) UnmarshalJSON

func (h *SuffrageNodeConnInfoRequestHeader) UnmarshalJSON(b []byte) error

type SuffrageProofRequestHeader

type SuffrageProofRequestHeader struct {
	BaseHeader
	// contains filtered or unexported fields
}

func NewSuffrageProofRequestHeader

func NewSuffrageProofRequestHeader(suffrageheight base.Height) SuffrageProofRequestHeader

func (SuffrageProofRequestHeader) Height

func (SuffrageProofRequestHeader) IsValid

func (h SuffrageProofRequestHeader) IsValid([]byte) error

func (SuffrageProofRequestHeader) MarshalJSON

func (h SuffrageProofRequestHeader) MarshalJSON() ([]byte, error)

func (*SuffrageProofRequestHeader) UnmarshalJSON

func (h *SuffrageProofRequestHeader) UnmarshalJSON(b []byte) error

type SyncSource

type SyncSource struct {
	Source interface{}
	Type   SyncSourceType
}

func (*SyncSource) DecodeYAML

func (d *SyncSource) DecodeYAML(b []byte, enc *jsonenc.Encoder) error

func (SyncSource) IsValid

func (s SyncSource) IsValid([]byte) error

type SyncSourceChecker

type SyncSourceChecker struct {
	*logging.Logging
	*util.ContextDaemon
	// contains filtered or unexported fields
}

func NewSyncSourceChecker

func NewSyncSourceChecker(
	local base.Node,
	networkID base.NetworkID,
	client isaac.NetworkClient,
	interval time.Duration,
	enc encoder.Encoder,
	sources []SyncSource,
	callback func(called int64, _ []isaac.NodeConnInfo, _ error),
) *SyncSourceChecker

func (*SyncSourceChecker) Sources

func (c *SyncSourceChecker) Sources() []SyncSource

func (*SyncSourceChecker) UpdateSources

func (c *SyncSourceChecker) UpdateSources(cis []SyncSource)

type SyncSourceConnInfoRequestHeader

type SyncSourceConnInfoRequestHeader struct {
	BaseHeader
}

func NewSyncSourceConnInfoRequestHeader

func NewSyncSourceConnInfoRequestHeader() SyncSourceConnInfoRequestHeader

func (SyncSourceConnInfoRequestHeader) IsValid

func (*SyncSourceConnInfoRequestHeader) UnmarshalJSON

func (h *SyncSourceConnInfoRequestHeader) UnmarshalJSON(b []byte) error

type SyncSourceType

type SyncSourceType string
var (
	SyncSourceTypeNode          SyncSourceType = "sync-source-node"
	SyncSourceTypeSuffrageNodes SyncSourceType = "sync-source-suffrage-nodes"
	SyncSourceTypeSyncSources   SyncSourceType = "sync-source-sync-sources"
	SyncSourceTypeURL           SyncSourceType = "sync-source-url"
)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL