Versions in this module Expand all Collapse all v1 v1.8.21 Jan 21, 2019 Changes in this version + const BatchSize + const HashSize + const High + const Low + const Mid + const PriorityQueue + const PriorityQueueCap + const Top + var ErrMaxPeerServers = errors.New("max peer servers") + func FormatSyncBinKey(bin uint8) string + func ParseSyncBinKey(s string) (uint8, error) + func RegisterSwarmSyncerClient(streamer *Registry, store storage.SyncChunkStore) + func RegisterSwarmSyncerServer(streamer *Registry, syncChunkStore storage.SyncChunkStore) + type API struct + func NewAPI(r *Registry) *API + func (api *API) SubscribeStream(peerId enode.ID, s Stream, history *Range, priority uint8) error + func (api *API) UnsubscribeStream(peerId enode.ID, s Stream) error + type ChunkDeliveryMsg struct + Addr storage.Address + SData []byte + type ChunkDeliveryMsgRetrieval ChunkDeliveryMsg + type ChunkDeliveryMsgSyncing ChunkDeliveryMsg + type Client interface + BatchDone func(Stream, uint64, []byte, []byte) func() (*TakeoverProof, error) + Close func() + NeedData func(context.Context, []byte) func(context.Context) error + type Delivery struct + func NewDelivery(kad *network.Kademlia, chunkStore storage.SyncChunkStore) *Delivery + func (d *Delivery) RequestFromPeers(ctx context.Context, req *network.Request) (*enode.ID, chan struct{}, error) + type Handover struct + End uint64 + Root []byte + Start uint64 + Stream Stream + type HandoverProof struct + Sig []byte + type OfferedHashesMsg struct + From uint64 + Hashes []byte + Stream Stream + To uint64 + func (m OfferedHashesMsg) String() string + type Peer struct + func NewPeer(peer *protocols.Peer, streamer *Registry) *Peer + func (p *Peer) Deliver(ctx context.Context, chunk storage.Chunk, priority uint8, syncing bool) error + func (p *Peer) HandleMsg(ctx context.Context, msg interface{}) error + func (p *Peer) SendOfferedHashes(s *server, f, t uint64) error + func (p *Peer) SendPriority(ctx context.Context, msg interface{}, priority uint8) error + type QuitMsg struct + Stream Stream + type Range struct + From uint64 + To uint64 + func NewRange(from, to uint64) *Range + func (r *Range) String() string + type Registry struct + func NewRegistry(localID enode.ID, delivery *Delivery, syncChunkStore storage.SyncChunkStore, ...) *Registry + func (r *Registry) APIs() []rpc.API + func (r *Registry) Close() error + func (r *Registry) GetClientFunc(stream string) (func(*Peer, string, bool) (Client, error), error) + func (r *Registry) GetServerFunc(stream string) (func(*Peer, string, bool) (Server, error), error) + func (r *Registry) GetSpec() *protocols.Spec + func (r *Registry) Protocols() []p2p.Protocol + func (r *Registry) Quit(peerId enode.ID, s Stream) error + func (r *Registry) RegisterClientFunc(stream string, f func(*Peer, string, bool) (Client, error)) + func (r *Registry) RegisterServerFunc(stream string, f func(*Peer, string, bool) (Server, error)) + func (r *Registry) RequestSubscription(peerId enode.ID, s Stream, h *Range, prio uint8) error + func (r *Registry) Run(p *network.BzzPeer) error + func (r *Registry) Start(server *p2p.Server) error + func (r *Registry) Stop() error + func (r *Registry) Subscribe(peerId enode.ID, s Stream, h *Range, priority uint8) error + func (r *Registry) Unsubscribe(peerId enode.ID, s Stream) error + type RegistryOptions struct + MaxPeerServers int + Retrieval RetrievalOption + SkipCheck bool + SyncUpdateDelay time.Duration + Syncing SyncingOption + type RequestSubscriptionMsg struct + History *Range + Priority uint8 + Stream Stream + type RetrievalOption int + const RetrievalClientOnly + const RetrievalDisabled + const RetrievalEnabled + type RetrieveRequestMsg struct + Addr storage.Address + HopCount uint8 + SkipCheck bool + type Server interface + Close func() + GetData func(context.Context, []byte) ([]byte, error) + SessionIndex func() (uint64, error) + SetNextBatch func(uint64, uint64) (hashes []byte, from uint64, to uint64, proof *HandoverProof, err error) + type Stream struct + Key string + Live bool + Name string + func NewStream(name string, key string, live bool) Stream + func (s Stream) String() string + type StreamerPrices struct + func (sp *StreamerPrices) Price(msg interface{}) *protocols.Price + type SubscribeErrorMsg struct + Error string + type SubscribeMsg struct + History *Range + Priority uint8 + Stream Stream + type SwarmChunkServer struct + func NewSwarmChunkServer(chunkStore storage.ChunkStore) *SwarmChunkServer + func (s *SwarmChunkServer) Close() + func (s *SwarmChunkServer) GetData(ctx context.Context, key []byte) ([]byte, error) + func (s *SwarmChunkServer) SessionIndex() (uint64, error) + func (s *SwarmChunkServer) SetNextBatch(_, _ uint64) (hashes []byte, from uint64, to uint64, proof *HandoverProof, err error) + type SwarmSyncerClient struct + func NewSwarmSyncerClient(p *Peer, store storage.SyncChunkStore, stream Stream) (*SwarmSyncerClient, error) + func (s *SwarmSyncerClient) BatchDone(stream Stream, from uint64, hashes []byte, root []byte) func() (*TakeoverProof, error) + func (s *SwarmSyncerClient) Close() + func (s *SwarmSyncerClient) NeedData(ctx context.Context, key []byte) (wait func(context.Context) error) + type SwarmSyncerServer struct + func NewSwarmSyncerServer(po uint8, syncChunkStore storage.SyncChunkStore) (*SwarmSyncerServer, error) + func (s *SwarmSyncerServer) Close() + func (s *SwarmSyncerServer) GetData(ctx context.Context, key []byte) ([]byte, error) + func (s *SwarmSyncerServer) SessionIndex() (uint64, error) + func (s *SwarmSyncerServer) SetNextBatch(from, to uint64) ([]byte, uint64, uint64, *HandoverProof, error) + type SyncingOption int + const SyncingAutoSubscribe + const SyncingDisabled + const SyncingRegisterOnly + type Takeover Handover + type TakeoverProof struct + Sig []byte + type TakeoverProofMsg TakeoverProof + func (m TakeoverProofMsg) String() string + type UnsubscribeMsg struct + Stream Stream + type WantedHashesMsg struct + From uint64 + Stream Stream + To uint64 + Want []byte + func (m WantedHashesMsg) String() string + type WrappedPriorityMsg struct + Context context.Context + Msg interface{}