Documentation
¶
Index ¶
- Constants
- Variables
- type Config
- func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *Config) CloneVT() *Config
- func (this *Config) EqualMessageVT(thatMsg any) bool
- func (this *Config) EqualVT(that *Config) bool
- func (c *Config) EqualsConfig(other config.Config) bool
- func (x *Config) GetBucketId() string
- func (c *Config) GetConfigID() string
- func (x *Config) GetMaxForwardHops() uint32
- func (x *Config) GetPeerId() string
- func (x *Config) GetTransportId() uint64
- func (x *Config) MarshalJSON() ([]byte, error)
- func (x *Config) MarshalProtoJSON(s *json.MarshalState)
- func (x *Config) MarshalProtoText() string
- func (m *Config) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *Config) MarshalToVT(dAtA []byte) (int, error)
- func (m *Config) MarshalVT() (dAtA []byte, err error)
- func (c *Config) ParsePeerID() (peer.ID, error)
- func (*Config) ProtoMessage()
- func (x *Config) Reset()
- func (m *Config) SizeVT() (n int)
- func (x *Config) String() string
- func (x *Config) UnmarshalJSON(b []byte) error
- func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *Config) UnmarshalVT(dAtA []byte) error
- func (c *Config) Validate() error
- type Controller
- type DexMessage
- func (m *DexMessage) CloneMessageVT() protobuf_go_lite.CloneMessage
- func (m *DexMessage) CloneVT() *DexMessage
- func (this *DexMessage) EqualMessageVT(thatMsg any) bool
- func (this *DexMessage) EqualVT(that *DexMessage) bool
- func (x *DexMessage) GetData() []byte
- func (x *DexMessage) GetError() string
- func (x *DexMessage) GetFound() bool
- func (x *DexMessage) GetIsResponse() bool
- func (x *DexMessage) GetRef() *block.BlockRef
- func (x *DexMessage) GetRemainingHops() uint32
- func (x *DexMessage) GetRequestId() uint32
- func (x *DexMessage) MarshalJSON() ([]byte, error)
- func (x *DexMessage) MarshalProtoJSON(s *json.MarshalState)
- func (x *DexMessage) MarshalProtoText() string
- func (m *DexMessage) MarshalToSizedBufferVT(dAtA []byte) (int, error)
- func (m *DexMessage) MarshalToVT(dAtA []byte) (int, error)
- func (m *DexMessage) MarshalVT() (dAtA []byte, err error)
- func (*DexMessage) ProtoMessage()
- func (x *DexMessage) Reset()
- func (m *DexMessage) SizeVT() (n int)
- func (x *DexMessage) String() string
- func (x *DexMessage) UnmarshalJSON(b []byte) error
- func (x *DexMessage) UnmarshalProtoJSON(s *json.UnmarshalState)
- func (m *DexMessage) UnmarshalVT(dAtA []byte) error
- type Factory
- func (t *Factory) Construct(ctx context.Context, conf config.Config, opts controller.ConstructOpts) (controller.Controller, error)
- func (t *Factory) ConstructConfig() config.Config
- func (t *Factory) GetConfigID() string
- func (t *Factory) GetControllerID() string
- func (t *Factory) GetVersion() controller.Version
Constants ¶
const ConfigID = ControllerID
ConfigID is the identifier for the config type.
const ControllerID = "hydra/dex/solicit"
ControllerID is the ID of the controller.
const DexProtocolID = protocol.ID("hydra/dex")
DexProtocolID is the protocol ID used for solicitation.
Variables ¶
var Version = controller.MustParseVersion("0.0.1")
Version is the version of the controller implementation.
Functions ¶
This section is empty.
Types ¶
type Config ¶
type Config struct {
// BucketId is the bucket ID to use to serve and store blocks.
BucketId string `protobuf:"bytes,1,opt,name=bucket_id,json=bucketId,proto3" json:"bucketId,omitempty"`
// PeerId is the peer ID to use for DEX.
// If empty, attaches to any available peer.
PeerId string `protobuf:"bytes,2,opt,name=peer_id,json=peerId,proto3" json:"peerId,omitempty"`
// TransportId sets a transport ID constraint.
// Can be empty.
TransportId uint64 `protobuf:"varint,3,opt,name=transport_id,json=transportId,proto3" json:"transportId,omitempty"`
// MaxForwardHops is the maximum number of times a request can be
// forwarded between peers. Zero disables forwarding (default).
MaxForwardHops uint32 `protobuf:"varint,4,opt,name=max_forward_hops,json=maxForwardHops,proto3" json:"maxForwardHops,omitempty"`
// contains filtered or unexported fields
}
Config configures the solicitation-based DEX controller.
func (*Config) CloneMessageVT ¶
func (m *Config) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*Config) EqualMessageVT ¶
func (*Config) EqualsConfig ¶
EqualsConfig checks if the config is equal to another.
func (*Config) GetBucketId ¶
func (*Config) GetConfigID ¶
GetConfigID returns the unique string for this configuration type.
func (*Config) GetMaxForwardHops ¶
func (*Config) GetTransportId ¶
func (*Config) MarshalJSON ¶
MarshalJSON marshals the Config to JSON.
func (*Config) MarshalProtoJSON ¶
func (x *Config) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the Config message to JSON.
func (*Config) MarshalProtoText ¶
func (*Config) MarshalToSizedBufferVT ¶
func (*Config) ParsePeerID ¶
ParsePeerID parses the peer ID from config.
func (*Config) ProtoMessage ¶
func (*Config) ProtoMessage()
func (*Config) UnmarshalJSON ¶
UnmarshalJSON unmarshals the Config from JSON.
func (*Config) UnmarshalProtoJSON ¶
func (x *Config) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the Config message from JSON.
func (*Config) UnmarshalVT ¶
type Controller ¶
type Controller struct {
// contains filtered or unexported fields
}
Controller is the solicitation-based DEX controller.
func NewController ¶
NewController constructs a new solicitation-based DEX controller.
func (*Controller) Close ¶
func (c *Controller) Close() error
Close releases any resources used by the controller.
func (*Controller) Execute ¶
func (c *Controller) Execute(ctx context.Context) error
Execute executes the controller goroutine.
func (*Controller) GetControllerInfo ¶
func (c *Controller) GetControllerInfo() *controller.Info
GetControllerInfo returns information about the controller.
func (*Controller) HandleDirective ¶
func (c *Controller) HandleDirective( ctx context.Context, di directive.Instance, ) ([]directive.Resolver, error)
HandleDirective asks if the handler can resolve the directive.
type DexMessage ¶
type DexMessage struct {
// RequestId is a unique ID for this request/response pair.
// The requester picks a unique ID. The responder echoes it back.
RequestId uint32 `protobuf:"varint,1,opt,name=request_id,json=requestId,proto3" json:"requestId,omitempty"`
// IsResponse indicates this is a response to a prior request.
IsResponse bool `protobuf:"varint,2,opt,name=is_response,json=isResponse,proto3" json:"isResponse,omitempty"`
// Ref is the block reference to look up (request only).
Ref *block.BlockRef `protobuf:"bytes,3,opt,name=ref,proto3" json:"ref,omitempty"`
// Found indicates whether the block was found (response only).
Found bool `protobuf:"varint,4,opt,name=found,proto3" json:"found,omitempty"`
// Data is the block data (response only).
Data []byte `protobuf:"bytes,5,opt,name=data,proto3" json:"data,omitempty"`
// Error is an error message (response only).
Error string `protobuf:"bytes,6,opt,name=error,proto3" json:"error,omitempty"`
// RemainingHops limits forwarding to prevent loops.
// When a node does not have the block locally and remaining_hops > 0,
// it forwards the request to other connected peers with remaining_hops - 1.
// Zero means no forwarding allowed (local lookup only).
RemainingHops uint32 `protobuf:"varint,7,opt,name=remaining_hops,json=remainingHops,proto3" json:"remainingHops,omitempty"`
// contains filtered or unexported fields
}
DexMessage is a message sent over a DEX stream. Each message is either a request or a response, distinguished by the request_id field. A request has a non-empty ref and a zero-value response. A response has a non-zero request_id and the response fields set.
func (*DexMessage) CloneMessageVT ¶
func (m *DexMessage) CloneMessageVT() protobuf_go_lite.CloneMessage
func (*DexMessage) CloneVT ¶
func (m *DexMessage) CloneVT() *DexMessage
func (*DexMessage) EqualMessageVT ¶
func (this *DexMessage) EqualMessageVT(thatMsg any) bool
func (*DexMessage) EqualVT ¶
func (this *DexMessage) EqualVT(that *DexMessage) bool
func (*DexMessage) GetData ¶
func (x *DexMessage) GetData() []byte
func (*DexMessage) GetError ¶
func (x *DexMessage) GetError() string
func (*DexMessage) GetFound ¶
func (x *DexMessage) GetFound() bool
func (*DexMessage) GetIsResponse ¶
func (x *DexMessage) GetIsResponse() bool
func (*DexMessage) GetRef ¶
func (x *DexMessage) GetRef() *block.BlockRef
func (*DexMessage) GetRemainingHops ¶
func (x *DexMessage) GetRemainingHops() uint32
func (*DexMessage) GetRequestId ¶
func (x *DexMessage) GetRequestId() uint32
func (*DexMessage) MarshalJSON ¶
func (x *DexMessage) MarshalJSON() ([]byte, error)
MarshalJSON marshals the DexMessage to JSON.
func (*DexMessage) MarshalProtoJSON ¶
func (x *DexMessage) MarshalProtoJSON(s *json.MarshalState)
MarshalProtoJSON marshals the DexMessage message to JSON.
func (*DexMessage) MarshalProtoText ¶
func (x *DexMessage) MarshalProtoText() string
func (*DexMessage) MarshalToSizedBufferVT ¶
func (m *DexMessage) MarshalToSizedBufferVT(dAtA []byte) (int, error)
func (*DexMessage) MarshalToVT ¶
func (m *DexMessage) MarshalToVT(dAtA []byte) (int, error)
func (*DexMessage) MarshalVT ¶
func (m *DexMessage) MarshalVT() (dAtA []byte, err error)
func (*DexMessage) ProtoMessage ¶
func (*DexMessage) ProtoMessage()
func (*DexMessage) Reset ¶
func (x *DexMessage) Reset()
func (*DexMessage) SizeVT ¶
func (m *DexMessage) SizeVT() (n int)
func (*DexMessage) String ¶
func (x *DexMessage) String() string
func (*DexMessage) UnmarshalJSON ¶
func (x *DexMessage) UnmarshalJSON(b []byte) error
UnmarshalJSON unmarshals the DexMessage from JSON.
func (*DexMessage) UnmarshalProtoJSON ¶
func (x *DexMessage) UnmarshalProtoJSON(s *json.UnmarshalState)
UnmarshalProtoJSON unmarshals the DexMessage message from JSON.
func (*DexMessage) UnmarshalVT ¶
func (m *DexMessage) UnmarshalVT(dAtA []byte) error
type Factory ¶
type Factory struct {
// contains filtered or unexported fields
}
Factory constructs a solicitation-based DEX controller.
func NewFactory ¶
NewFactory builds a solicitation-based DEX controller factory.
func (*Factory) Construct ¶
func (t *Factory) Construct( ctx context.Context, conf config.Config, opts controller.ConstructOpts, ) (controller.Controller, error)
Construct constructs the associated controller given configuration.
func (*Factory) ConstructConfig ¶
ConstructConfig constructs an instance of the controller configuration.
func (*Factory) GetConfigID ¶
GetConfigID returns the unique ID for the config.
func (*Factory) GetControllerID ¶
GetControllerID returns the unique ID for the controller.
func (*Factory) GetVersion ¶
func (t *Factory) GetVersion() controller.Version
GetVersion returns the version of this controller.