go-http-peering/store.go

27 lines
574 B
Go
Raw Permalink Normal View History

2019-02-03 20:56:58 +01:00
package peering
import (
"errors"
"time"
)
var (
ErrPeerNotFound = errors.New("peer not found")
ErrPeerExists = errors.New("peer exists")
)
type Store interface {
Create(id PeerID, attrs PeerAttributes) (*Peer, error)
Get(id PeerID) (*Peer, error)
Delete(id PeerID) error
List() ([]PeerHeader, error)
UpdatePublicKey(id PeerID, publicKey []byte) error
UpdateAttributes(id PeerID, attrs PeerAttributes) error
UpdateLastContact(id PeerID, remoteAddress string, ts time.Time) error
Accept(id PeerID) error
Forget(id PeerID) error
Reject(id PeerID) error
}