Documentation ¶
Index ¶
- Constants
- func VerifyDataFromPeer(data []byte, signature []byte, peerID peer.ID, pubKeyData []byte) error
- type Interface
- type Protocol
- func (d *Protocol) GetQueryHistory(key string) (messages.DataQueryRequest, bool)
- func (d *Protocol) GetQueryResponse(key string) ([]messages.DataQueryResponse, bool)
- func (d *Protocol) PurgeQueryHistory() error
- func (d *Protocol) PutQueryHistory(key string, val messages.DataQueryRequest, localTimestamp int64) error
- func (d *Protocol) PutQueryResponse(key string, val messages.DataQueryResponse)
- func (d *Protocol) RequestDataQueryResponseTransfer(ctx context.Context, peerID peer.ID, ...) error
- func (d *Protocol) SendDataQueryResponse(ctx context.Context, peerID peer.ID, payload *messages.DataQueryResponseProto) error
Constants ¶
View Source
const ( // ProtocolID represents the response protocol version ProtocolID = "/ffg/dataquery_response/1.0.0" // DataQueryResponseTransferProtocolID is a protocol to handle sending data query responses to a querying node. // this protocol will be mostly used by verifiers to act as a proxy so node's which cant be dialed back by the // file hoster can pull the data query response from the verifiers. DataQueryResponseTransferProtocolID = "/ffg/dataquery_response_transfer/1.0.0" )
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Interface ¶
type Interface interface { PutQueryHistory(key string, val messages.DataQueryRequest, localTimestamp int64) error GetQueryHistory(key string) (messages.DataQueryRequest, bool) PutQueryResponse(key string, val messages.DataQueryResponse) GetQueryResponse(key string) ([]messages.DataQueryResponse, bool) SendDataQueryResponse(ctx context.Context, peerID peer.ID, payload *messages.DataQueryResponseProto) error RequestDataQueryResponseTransfer(ctx context.Context, peerID peer.ID, request *messages.DataQueryResponseTransferProto) error PurgeQueryHistory() error }
Interface represents a data quertier.
type Protocol ¶
type Protocol struct {
// contains filtered or unexported fields
}
Protocol wraps the data query protocols and handlers
func (*Protocol) GetQueryHistory ¶
func (d *Protocol) GetQueryHistory(key string) (messages.DataQueryRequest, bool)
GetQueryHistory gets a val from history.
func (*Protocol) GetQueryResponse ¶
func (d *Protocol) GetQueryResponse(key string) ([]messages.DataQueryResponse, bool)
GetQueryResponse gets a val from responses
func (*Protocol) PurgeQueryHistory ¶ added in v1.1.18
PurgeQueryHistory purges/deletes all queries that are more than some minutes old.
func (*Protocol) PutQueryHistory ¶
func (d *Protocol) PutQueryHistory(key string, val messages.DataQueryRequest, localTimestamp int64) error
PutQueryHistory puts the query history. localTimestamp is the machine's timestamp which will be used to purge old queries automatically after they are expired.
func (*Protocol) PutQueryResponse ¶
func (d *Protocol) PutQueryResponse(key string, val messages.DataQueryResponse)
PutQueryResponse put into responses.
func (*Protocol) RequestDataQueryResponseTransfer ¶
func (d *Protocol) RequestDataQueryResponseTransfer(ctx context.Context, peerID peer.ID, request *messages.DataQueryResponseTransferProto) error
RequestDataQueryResponseTransfer requests a data query response transfer from a peer, mostly a verifier.
func (*Protocol) SendDataQueryResponse ¶
func (d *Protocol) SendDataQueryResponse(ctx context.Context, peerID peer.ID, payload *messages.DataQueryResponseProto) error
SendDataQueryResponse sends back the response to initiator
Click to show internal directories.
Click to hide internal directories.