quic

package
v1.1.4 Latest Latest
Warning

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

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

Documentation

Index

Constants

View Source
const (
	// DefaultPort is the port the peer server listens on if not passed in.
	DefaultPort = 3333
	// LbrycrdAddress to be used when paying for data. Not implemented yet.
	LbrycrdAddress = "bJxKvpD96kaJLriqVajZ7SaQTsWWyrGQct"
)

Variables

View Source
var ErrBlobExists = errors.Base("blob exists on server")

ErrBlobExists is a default error for when a blob already exists on the reflector server.

Functions

This section is empty.

Types

type Client

type Client struct {
	Timeout time.Duration
	// contains filtered or unexported fields
}

Client is an instance of a client connected to a server.

func (*Client) Close

func (c *Client) Close() error

Close closes the connection with the client.

func (*Client) Connect

func (c *Client) Connect(address string) error

Connect connects to a specific clients and errors if it cannot be contacted.

func (*Client) GetBlob

func (c *Client) GetBlob(hash string) (stream.Blob, error)

GetBlob gets a blob

func (*Client) GetStream

func (c *Client) GetStream(sdHash string, blobCache store.BlobStore) (stream.Stream, error)

GetStream gets a stream

func (*Client) HasBlob

func (c *Client) HasBlob(hash string) (bool, error)

HasBlob checks if the blob is available

type Server

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

Server is an instance of a peer server that houses the listener and store.

func NewServer

func NewServer(store store.BlobStore) *Server

NewServer returns an initialized Server pointer.

func (*Server) Shutdown

func (s *Server) Shutdown()

Shutdown gracefully shuts down the peer server.

func (*Server) Start

func (s *Server) Start(address string) error

Start starts the server listener to handle connections.

type Store

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

Store is a blob store that gets blobs from a peer. It satisfies the store.BlobStore interface but cannot put or delete blobs.

func NewStore

func NewStore(opts StoreOpts) *Store

NewStore makes a new peer store.

func (*Store) CloseStore

func (p *Store) CloseStore() error

CloseStore closes the client that gets initialized when the store is initialized

func (*Store) Delete

func (p *Store) Delete(hash string) error

Delete is not supported

func (*Store) Get

func (p *Store) Get(hash string) (stream.Blob, error)

Get downloads the blob from the peer

func (*Store) Has

func (p *Store) Has(hash string) (bool, error)

Has asks the peer if they have a hash

func (*Store) Put

func (p *Store) Put(hash string, blob stream.Blob) error

Put is not supported

func (*Store) PutSD

func (p *Store) PutSD(hash string, blob stream.Blob) error

PutSD is not supported

type StoreOpts

type StoreOpts struct {
	Address string
	Timeout time.Duration
}

StoreOpts allows to set options for a new Store.

Jump to

Keyboard shortcuts

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