Documentation ¶
Index ¶
Constants ¶
View Source
const ( BalanceKey = "eth_balance" //CurrentChallengeKey DB key CurrentChallengeKey = "current_challenge" RequestIdKey = "current_requestId" RequestIdKey0 = "current_requestId0" RequestIdKey1 = "current_requestId1" RequestIdKey2 = "current_requestId2" RequestIdKey3 = "current_requestId3" RequestIdKey4 = "current_requestId4" DifficultyKey = "current_difficulty" QueryStringKey = "current_query_string" GranularityKey = "current_granularity" TotalTipKey = "current_total_tip" MiningStatusKey = "mining_status" //GasKey GasKey = "wei_gas_price" //Top 50 Top50Key = "top_50_requestIds" //TributeBalance TributeBalanceKey = "trib_balance" //Dispute Status DisputeStatusKey = "dispute_status" //RequestID's are stored with this prefix and the id itself //e.g. "qm_2" represents request ID 2 QueryMetadataPrefix = "qm_" //Request values are stored with this prefix plus request id QueriedValuePrefix = "qv_" LastNewValueKey = "lastnewvalue" LastSubmissionKey = "last_submission" TimeOutKey = "time_out" )
BalanceKey is the key to store/lookup account balance
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type DB ¶
type DB interface { Has(key string) (bool, error) Put(key string, value []byte) error Get(key string) ([]byte, error) Delete(key string) error Close() error }
DB is the primary interface to an underlying datastore
type DataServerProxy ¶
type DataServerProxy interface { //RequestSigner //RequestValidator //local call to get a data server value by its key Get(key string) ([]byte, error) //local call to put data into the data server's store. All keys should //be prefixed with the calling miner's public ETH key to avoid conflicts. //Implementation must ensure thread safety from multiple miners attempting //to write at the same time. Put(key string, value []byte) (map[string][]byte, error) //put multiple keys and values on remote data server BatchPut(keys []string, values [][]byte) (map[string][]byte, error) //local call to get several data server values by their keys BatchGet(keys []string) (map[string][]byte, error) //notification that a remote miner has requested data IncomingRequest(data []byte) ([]byte, error) }
DataServerProxy interface for local interaction/abstraction/testing
func OpenLocalProxy ¶
func OpenLocalProxy(localDB DB) (DataServerProxy, error)
OpenLocalProxy creates a local data proxy so that the miner operations are seamless regardless whether accessing data remotely or locally
func OpenRemoteDB ¶
func OpenRemoteDB(localDB DB) (DataServerProxy, error)
OpenRemoteDB establishes a proxy to a remote data server
type RequestSigner ¶
type RequestSigner interface { //Sign the given payload hash with a private key and return the //signature bytes Sign(payload []byte) ([]byte, error) }
RequestSigner handles signing an outgoing request. It's just an abstraction so we can test, etc.
type RequestValidator ¶
type RequestValidator interface { //Verify the given signature was signed by a valid/whitelisted miner address Verify(hash []byte, timestamp int64, sig []byte) error }
RequestValidator validates that a miner's signature is valid, that its address is whitelisted, and minizes chances that the requested hash isn't being replayed
Click to show internal directories.
Click to hide internal directories.