peerstore

package
Version: v0.0.0-...-b598ae0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Feb 7, 2019 License: GPL-3.0 Imports: 12 Imported by: 0

Documentation

Index

Constants

View Source
const TABLE = "peers"

Variables

This section is empty.

Functions

func PeerToDnId

func PeerToDnId(id libp2pPeer.ID) (pId string, dID uint64)

libp2p peer id to uint64. Some apps expect some identification in the form of an integer. This will make it so we are compatible.

Types

type Store

type Store struct {
	Self      *pb.Peer
	SelfMutex sync.RWMutex

	Changed bool
	// contains filtered or unexported fields
}

func New

func New(ctx context.Context, size int, expireAt time.Duration, selfId libp2pPeer.ID, path string) (*Store, error)

func (*Store) FindAll

func (s *Store) FindAll() (result []*pb.Peer, err error)

func (*Store) FindByDecentralizedId

func (s *Store) FindByDecentralizedId(decentralizedId uint64) (*pb.Peer, error)

func (*Store) FindByDetails

func (s *Store) FindByDetails(key, value string) (result []*pb.Peer, err error)

func (*Store) FindByPeerId

func (s *Store) FindByPeerId(peerId string) (*pb.Peer, error)

func (*Store) Insert

func (s *Store) Insert(info *pb.Peer) error

* Inserts a record. Takes a pointer peer. This pointer value is directly saved, meaning changes to this object will also change the value in the db.

func (*Store) Remove

func (s *Store) Remove(peerId string) error

func (*Store) Save

func (s *Store) Save()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
t or T : Toggle theme light dark auto
y or Y : Canonical URL