rpc

package
v0.2.3 Latest Latest
Warning

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

Go to latest
Published: May 20, 2020 License: MIT Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	TransactionExpiry = 15000
)

Variables

This section is empty.

Functions

func AddPeer

func AddPeer(client apiv1.DDRPv1Client, peerID string, ip string, verify bool) error

func AddPeerContext

func AddPeerContext(ctx context.Context, client apiv1.DDRPv1Client, peerID string, ip string, verify bool) error

func BanPeer

func BanPeer(client apiv1.DDRPv1Client, ip string, duration int) error

func BanPeerContext

func BanPeerContext(ctx context.Context, client apiv1.DDRPv1Client, ip string, duration int) error

func GetBlobInfo

func GetBlobInfo(client apiv1.DDRPv1Client, name string) (*store.BlobInfo, error)

func GetBlobInfoContext

func GetBlobInfoContext(ctx context.Context, client apiv1.DDRPv1Client, name string) (*store.BlobInfo, error)

func ListBlobInfo

func ListBlobInfo(client apiv1.DDRPv1Client, after string, cb func(info *store.BlobInfo) bool) error

func ListBlobInfoContext

func ListBlobInfoContext(ctx context.Context, client apiv1.DDRPv1Client, start string, cb func(info *store.BlobInfo) bool) error

func UnbanPeer

func UnbanPeer(client apiv1.DDRPv1Client, ip string) error

func UnbanPeerContext

func UnbanPeerContext(ctx context.Context, client apiv1.DDRPv1Client, ip string) error

Types

type BlobReader

type BlobReader struct {
	// contains filtered or unexported fields
}

func NewBlobReader

func NewBlobReader(client apiv1.DDRPv1Client, name string) *BlobReader

func (*BlobReader) Read

func (b *BlobReader) Read(p []byte) (int, error)

func (*BlobReader) ReadAt

func (b *BlobReader) ReadAt(p []byte, off int64) (int, error)

func (*BlobReader) Seek added in v0.2.1

func (b *BlobReader) Seek(off int64, whence int) (int64, error)

type BlobWriter

type BlobWriter struct {
	// contains filtered or unexported fields
}

func NewBlobWriter

func NewBlobWriter(client apiv1.DDRPv1Client, signer crypto.Signer, name string) *BlobWriter

func (*BlobWriter) Commit

func (b *BlobWriter) Commit(broadcast bool) error

func (*BlobWriter) Open

func (b *BlobWriter) Open() error

func (*BlobWriter) Seek

func (b *BlobWriter) Seek(offset int64, whence int) (int64, error)

func (*BlobWriter) Truncate

func (b *BlobWriter) Truncate() error

func (*BlobWriter) Write

func (b *BlobWriter) Write(p []byte) (int, error)

func (*BlobWriter) WriteAt

func (b *BlobWriter) WriteAt(p []byte, off int64) (int, error)

type Opts

type Opts struct {
	PeerID      crypto.Hash
	BlobStore   blob.Store
	PeerManager p2p.PeerManager
	NameLocker  util.MultiLocker
	Mux         *p2p.PeerMuxer
	DB          *leveldb.DB
	Host        string
	Port        int
}

type Peer

type Peer struct {
	ID          string
	IP          string
	Banned      bool
	Whitelisted bool
	Connected   bool
	TxBytes     uint64
	RxBytes     uint64
}

func ListPeers

func ListPeers(client apiv1.DDRPv1Client) ([]*Peer, error)

func ListPeersContext

func ListPeersContext(ctx context.Context, client apiv1.DDRPv1Client) ([]*Peer, error)

type Server

type Server struct {
	// contains filtered or unexported fields
}

func NewServer

func NewServer(opts *Opts) *Server

func (*Server) AddPeer

func (s *Server) AddPeer(_ context.Context, req *apiv1.AddPeerReq) (*apiv1.Empty, error)

func (*Server) BanPeer

func (s *Server) BanPeer(_ context.Context, req *apiv1.BanPeerReq) (*apiv1.Empty, error)

func (*Server) Checkout

func (s *Server) Checkout(ctx context.Context, req *apiv1.CheckoutReq) (*apiv1.CheckoutRes, error)

func (*Server) Commit

func (s *Server) Commit(ctx context.Context, req *apiv1.CommitReq) (*apiv1.CommitRes, error)

func (*Server) GetBlobInfo

func (s *Server) GetBlobInfo(_ context.Context, req *apiv1.BlobInfoReq) (*apiv1.BlobInfoRes, error)

func (*Server) GetStatus

func (s *Server) GetStatus(context.Context, *apiv1.Empty) (*apiv1.GetStatusRes, error)

func (*Server) ListBlobInfo

func (s *Server) ListBlobInfo(req *apiv1.ListBlobInfoReq, srv apiv1.DDRPv1_ListBlobInfoServer) error

func (*Server) ListPeers

func (s *Server) ListPeers(req *apiv1.ListPeersReq, stream apiv1.DDRPv1_ListPeersServer) error

func (*Server) PreCommit

func (s *Server) PreCommit(ctx context.Context, req *apiv1.PreCommitReq) (*apiv1.PreCommitRes, error)

func (*Server) ReadAt

func (s *Server) ReadAt(_ context.Context, req *apiv1.ReadAtReq) (*apiv1.ReadAtRes, error)

func (*Server) SendUpdate

func (s *Server) SendUpdate(_ context.Context, req *apiv1.SendUpdateReq) (*apiv1.SendUpdateRes, error)

func (*Server) Start

func (s *Server) Start() error

func (*Server) Stop

func (s *Server) Stop() error

func (*Server) Truncate

func (s *Server) Truncate(ctx context.Context, req *apiv1.TruncateReq) (*apiv1.Empty, error)

func (*Server) UnbanPeer

func (s *Server) UnbanPeer(_ context.Context, req *apiv1.UnbanPeerReq) (*apiv1.Empty, error)

func (*Server) WriteAt

func (s *Server) WriteAt(ctx context.Context, req *apiv1.WriteAtReq) (*apiv1.WriteAtRes, error)

type Status

type Status struct {
	PeerID      string
	PeerCount   int
	HeaderCount int
	TxBytes     uint64
	RxBytes     uint64
}

func GetStatus

func GetStatus(client apiv1.DDRPv1Client) (*Status, error)

func GetStatusContext

func GetStatusContext(ctx context.Context, client apiv1.DDRPv1Client) (*Status, error)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL