Documentation ¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidRecordType = errors.New("invalid record keytype")
ErrInvalidRecordType is returned if a DHTRecord keys prefix is not found in the Validator map of the DHT.
Functions ¶
func MakePutRecord ¶
MakePutRecord creates a dht record for the given key/value pair
Types ¶
type ErrBetterRecord ¶
type ErrBetterRecord struct { // Key is the key associated with the record. Key string // Value is the best value that was found, according to the record's // validator. Value []byte }
ErrBetterRecord is returned by a subsystem when it fails because it found a better record.
func (*ErrBetterRecord) Error ¶
func (e *ErrBetterRecord) Error() string
type NamespacedValidator ¶
NamespacedValidator is a validator that delegates to sub-validators by namespace.
func (NamespacedValidator) Select ¶
func (v NamespacedValidator) Select(key string, values [][]byte) (int, error)
Select conforms to the Validator interface.
func (NamespacedValidator) Validate ¶
func (v NamespacedValidator) Validate(key string, value []byte) error
Validate conforms to the Validator interface.
func (NamespacedValidator) ValidatorByKey ¶
func (v NamespacedValidator) ValidatorByKey(key string) Validator
ValidatorByKey looks up the validator responsible for validating the given key.
type PublicKeyValidator ¶
type PublicKeyValidator struct{}
PublicKeyValidator is a Validator that validates public keys.
type Validator ¶
type Validator interface { // Validate validates the given record, returning an error if it's // invalid (e.g., expired, signed by the wrong key, etc.). Validate(key string, value []byte) error // Select selects the best record from the set of records (e.g., the // newest). // // Decisions made by select should be stable. Select(key string, values [][]byte) (int, error) }
Validator is an interface that should be implemented by record validators.
Click to show internal directories.
Click to hide internal directories.