service

package
v0.0.0-...-cc45bd3 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2022 License: Apache-2.0 Imports: 36 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type AddProviders

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

func (*AddProviders) List

func (ap *AddProviders) List(ctx context.Context, provide *models.Provide) ([]*models.AddProviderRPC, error)

func (*AddProviders) Save

func (ap *AddProviders) Save(ctx context.Context, exec boil.ContextExecutor, h *dht.Host, apReqs []*AddProvidersSpan, peerInfos map[peer.ID]*PeerInfo) (models.AddProviderRPCSlice, error)

type AddProvidersService

type AddProvidersService interface {
	List(ctx context.Context, provide *models.Provide) ([]*models.AddProviderRPC, error)
	Save(ctx context.Context, exec boil.ContextExecutor, h *dht.Host, apReqs []*AddProvidersSpan, peerInfos map[peer.ID]*PeerInfo) (models.AddProviderRPCSlice, error)
}

func NewAddProvidersService

func NewAddProvidersService(peerService PeerService, maService MultiAddressService, apRepo repo.AddProvidersRepo, cpRepo repo.CloserPeersRepo) AddProvidersService

type AddProvidersSpan

type AddProvidersSpan struct {
	QueryID       uuid.UUID
	RemotePeerID  peer.ID
	Content       *util.Content
	Start         time.Time
	ProviderAddrs []ma.Multiaddr
	End           time.Time
	Error         error
}

type Connection

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

func (*Connection) List

func (c *Connection) List(ctx context.Context, provide *models.Provide) (models.ConnectionSlice, error)

func (*Connection) Save

func (c *Connection) Save(ctx context.Context, exec boil.ContextExecutor, h *dht.Host, conns []*ConnectionSpan, peerInfos map[peer.ID]*PeerInfo) (models.ConnectionSlice, error)

type ConnectionService

type ConnectionService interface {
	List(ctx context.Context, provide *models.Provide) (models.ConnectionSlice, error)
	Save(ctx context.Context, exec boil.ContextExecutor, h *dht.Host, conns []*ConnectionSpan, peerInfos map[peer.ID]*PeerInfo) (models.ConnectionSlice, error)
}

func NewConnectionService

func NewConnectionService(peerService PeerService, maService MultiAddressService, repo repo.ConnectionRepo) ConnectionService

type ConnectionSpan

type ConnectionSpan struct {
	RemotePeerID peer.ID
	Maddr        ma.Multiaddr
	Start        time.Time
	End          time.Time
}

type Dial

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

func (*Dial) List

func (d *Dial) List(ctx context.Context, provide *models.Provide) (models.DialSlice, error)

func (*Dial) Save

func (d *Dial) Save(ctx context.Context, exec boil.ContextExecutor, h *dht.Host, dials []*DialSpan, peerInfos map[peer.ID]*PeerInfo) (models.DialSlice, error)

type DialService

type DialService interface {
	List(ctx context.Context, provide *models.Provide) (models.DialSlice, error)
	Save(ctx context.Context, exec boil.ContextExecutor, h *dht.Host, dials []*DialSpan, peerInfos map[peer.ID]*PeerInfo) (models.DialSlice, error)
}

func NewDialService

func NewDialService(peerService PeerService, maService MultiAddressService, dialRepo repo.DialRepo) DialService

type DialSpan

type DialSpan struct {
	RemotePeerID peer.ID
	Maddr        ma.Multiaddr
	Start        time.Time
	End          time.Time
	Trpt         string
	Error        error
}

type FindNodes

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

func (*FindNodes) Save

func (fn *FindNodes) Save(ctx context.Context, exec boil.ContextExecutor, h *dht.Host, fnReqs []*FindNodesSpan, peerInfos map[peer.ID]*PeerInfo) (models.FindNodesRPCSlice, error)

type FindNodesService

type FindNodesService interface {
	Save(ctx context.Context, exec boil.ContextExecutor, h *dht.Host, fnReqs []*FindNodesSpan, peerInfos map[peer.ID]*PeerInfo) (models.FindNodesRPCSlice, error)
}

func NewFindNodesService

func NewFindNodesService(peerService PeerService, maService MultiAddressService, fnRepo repo.FindNodesRPCRepo, cpRepo repo.CloserPeersRepo) FindNodesService

type FindNodesSpan

type FindNodesSpan struct {
	QueryID      uuid.UUID
	RemotePeerID peer.ID
	Start        time.Time
	End          time.Time
	CloserPeers  []*peer.AddrInfo
	Error        error
}

type GetProviders

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

func (*GetProviders) Save

type GetProvidersService

type GetProvidersService interface {
	Save(ctx context.Context, exec boil.ContextExecutor, h *dht.Host, fnReqs []*GetProvidersSpan) (models.GetProvidersRPCSlice, error)
}

func NewGetProvidersService

func NewGetProvidersService(peerService PeerService, maService MultiAddressService, gpRepo repo.GetProvidersRepo) GetProvidersService

type GetProvidersSpan

type GetProvidersSpan struct {
	QueryID      *uuid.UUID
	RemotePeerID peer.ID
	Start        time.Time
	End          time.Time
	Providers    []*peer.AddrInfo
	CloserPeers  []*peer.AddrInfo
	Error        error
}

type Host

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

func (*Host) Archive

func (hs *Host) Archive(ctx context.Context, dbHost *models.Host) error

func (*Host) Create

func (hs *Host) Create(ctx context.Context, name string, network types.NetworkType) (*dht.Host, error)

func (*Host) Host

func (hs *Host) Host(ctx context.Context, p peer.ID) (*dht.Host, error)

func (*Host) Hosts

func (hs *Host) Hosts(ctx context.Context) (map[string]*dht.Host, models.HostSlice, error)

func (*Host) Start

func (hs *Host) Start(ctx context.Context, h *dht.Host) (*dht.Host, error)

func (*Host) Stop

func (hs *Host) Stop(p peer.ID) error

type HostService

type HostService interface {
	Create(ctx context.Context, name string, network types.NetworkType) (*dht.Host, error)
	Hosts(ctx context.Context) (map[string]*dht.Host, models.HostSlice, error)
	Host(ctx context.Context, p peer.ID) (*dht.Host, error)
	Start(ctx context.Context, h *dht.Host) (*dht.Host, error)
	Stop(p peer.ID) error
	Archive(ctx context.Context, dbHost *models.Host) error
}

func NewHostService

func NewHostService(peerService PeerService, rtService RoutingTableService, hostRepo repo.HostRepo) HostService

type Measurement

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

func NewProvideMeasurementService

func NewProvideMeasurementService(ps ProvideService) *Measurement

func (*Measurement) StartProvide

func (*Measurement) Stop

func (m *Measurement) Stop(measurementID int) error

type MeasurementService

type MeasurementService interface {
	StartProvide(ctx context.Context, h *dht.Host, config types.ProvideMeasurementConfiguration) (*models.Measurement, error)
	Stop(measurementID int) error
}

type MultiAddress

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

func NewMultiAddressService

func NewMultiAddressService(maRepo repo.MultiAddressRepo, iaRepo repo.IPAddressRepo) *MultiAddress

func (*MultiAddress) UpsertMultiAddress

func (ma *MultiAddress) UpsertMultiAddress(ctx context.Context, exec boil.ContextExecutor, maddr ma.Multiaddr) (*models.MultiAddress, error)

func (*MultiAddress) UpsertMultiAddresses

func (ma *MultiAddress) UpsertMultiAddresses(ctx context.Context, exec boil.ContextExecutor, maddrs []ma.Multiaddr) ([]int64, error)

type MultiAddressService

type MultiAddressService interface {
	UpsertMultiAddress(ctx context.Context, exec boil.ContextExecutor, maddr ma.Multiaddr) (*models.MultiAddress, error)
	UpsertMultiAddresses(ctx context.Context, exec boil.ContextExecutor, maddr []ma.Multiaddr) ([]int64, error)
}

type Peer

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

func (*Peer) Find

func (ps *Peer) Find(ctx context.Context, p peer.ID) (*models.Peer, error)

func (*Peer) UpsertLocalPeer

func (ps *Peer) UpsertLocalPeer(ctx context.Context, exec boil.ContextExecutor, h host.Host) (*models.Peer, error)

func (*Peer) UpsertLocalPeerTxn

func (ps *Peer) UpsertLocalPeerTxn(ctx context.Context, h host.Host) (*models.Peer, error)

func (*Peer) UpsertPeer

func (ps *Peer) UpsertPeer(ctx context.Context, exec boil.ContextExecutor, h host.Host, pid peer.ID) (*models.Peer, error)

func (*Peer) UpsertPeerForInfo

func (ps *Peer) UpsertPeerForInfo(ctx context.Context, exec boil.ContextExecutor, h host.Host, pid peer.ID, pi *PeerInfo) (*models.Peer, error)

type PeerInfo

type PeerInfo struct {
	PeerID       peer.ID
	AgentVersion string
	Protocols    []string
}

func NewPeerInfo

func NewPeerInfo(pid peer.ID, ps peerstore.Peerstore) *PeerInfo

func (*PeerInfo) SetFromPeerstore

func (pi *PeerInfo) SetFromPeerstore(ps peerstore.Peerstore) bool

type PeerService

type PeerService interface {
	Find(ctx context.Context, p peer.ID) (*models.Peer, error)
	UpsertLocalPeer(ctx context.Context, exec boil.ContextExecutor, h host.Host) (*models.Peer, error)
	UpsertLocalPeerTxn(ctx context.Context, h host.Host) (*models.Peer, error)
	UpsertPeer(ctx context.Context, exec boil.ContextExecutor, h host.Host, pid peer.ID) (*models.Peer, error)
	UpsertPeerForInfo(ctx context.Context, exec boil.ContextExecutor, h host.Host, pid peer.ID, pi *PeerInfo) (*models.Peer, error)
}

func NewPeerService

func NewPeerService(repo repo.PeerRepo) PeerService

type PeerState

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

func (*PeerState) Save

type PeerStateService

type PeerStateService interface {
	Save(ctx context.Context, exec boil.ContextExecutor, h *dht.Host, uuid uuid.UUID, states []qpeerset.QueryPeerState) (models.PeerStateSlice, error)
}

func NewPeerStateService

func NewPeerStateService(peerService PeerService, psRepo repo.PeerStateRepo) PeerStateService

type Provide

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

func NewProvideService

func NewProvideService(peerService PeerService, hostService HostService, rtService RoutingTableService, maService MultiAddressService, dialService DialService, connService ConnectionService, fnService FindNodesService, psService PeerStateService, apService AddProvidersService, provideRepo repo.ProvideRepo) *Provide

func (*Provide) Get

func (ps *Provide) Get(ctx context.Context, h *dht.Host, provideID int) (*models.Provide, error)

func (*Provide) GetByID

func (ps *Provide) GetByID(ctx context.Context, provideID int) (*models.Provide, error)

func (*Provide) List

func (ps *Provide) List(ctx context.Context, h *dht.Host) ([]*models.Provide, error)

func (*Provide) Provide

func (ps *Provide) Provide(ctx context.Context, h *dht.Host, opts ...ProvideOption) (*models.Provide, error)

type ProvideConfig

type ProvideConfig struct {
	Sync                  bool
	Type                  types.ProvideType
	MeasurementID         int
	MultiQueryConcurrency int
}

func (*ProvideConfig) Apply

func (cfg *ProvideConfig) Apply(opts ...ProvideOption) error

Apply applies the given options to the config, returning the first error encountered (if any).

type ProvideOption

type ProvideOption func(cfg *ProvideConfig) error

func ProvideMeasurementID

func ProvideMeasurementID(id int) ProvideOption

func ProvideMultiQueryConcurrency

func ProvideMultiQueryConcurrency(concurrency int) ProvideOption

func ProvideSync

func ProvideSync() ProvideOption

func ProvideType

func ProvideType(t types.ProvideType) ProvideOption

type ProvideService

type ProvideService interface {
	Provide(ctx context.Context, h *dht.Host, opts ...ProvideOption) (*models.Provide, error)
	List(ctx context.Context, h *dht.Host) ([]*models.Provide, error)
	Get(ctx context.Context, h *dht.Host, id int) (*models.Provide, error)
	GetByID(ctx context.Context, id int) (*models.Provide, error)
}

type ProvideState

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

func NewProvideState

func NewProvideState(h *dht.Host, content *util.Content) *ProvideState

func (*ProvideState) ClosedStream

func (ps *ProvideState) ClosedStream(network network.Network, stream network.Stream)

func (*ProvideState) Connected

func (ps *ProvideState) Connected(network network.Network, conn network.Conn)

func (*ProvideState) DialEnded

func (ps *ProvideState) DialEnded(trpt string, raddr ma.Multiaddr, p peer.ID, start time.Time, end time.Time, err error)

func (*ProvideState) DialStarted

func (ps *ProvideState) DialStarted(trpt string, raddr ma.Multiaddr, p peer.ID, start time.Time)

func (*ProvideState) Disconnected

func (ps *ProvideState) Disconnected(network network.Network, conn network.Conn)

func (*ProvideState) Listen

func (ps *ProvideState) Listen(network network.Network, multiaddr ma.Multiaddr)

func (*ProvideState) ListenClose

func (ps *ProvideState) ListenClose(network network.Network, multiaddr ma.Multiaddr)

func (*ProvideState) OpenedStream

func (ps *ProvideState) OpenedStream(network network.Network, stream network.Stream)

func (*ProvideState) PeerInfos

func (ps *ProvideState) PeerInfos() map[peer.ID]*PeerInfo

func (*ProvideState) Register

func (ps *ProvideState) Register(ctx context.Context) context.Context

func (*ProvideState) Unregister

func (ps *ProvideState) Unregister()

type Retrieval

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

func NewRetrievalService

func NewRetrievalService(hostService HostService, rtService RoutingTableService, dialService DialService, connService ConnectionService, gpService GetProvidersService, psService PeerStateService, retrievalRepo repo.RetrievalRepo) *Retrieval

func (*Retrieval) List

func (rs *Retrieval) List(ctx context.Context, h *dht.Host) ([]*models.Retrieval, error)

func (*Retrieval) Retrieve

func (rs *Retrieval) Retrieve(ctx context.Context, h *dht.Host, contentID cid.Cid, count int) (*models.Retrieval, error)

type RetrievalService

type RetrievalService interface {
	List(ctx context.Context, h *dht.Host) ([]*models.Retrieval, error)
	Retrieve(ctx context.Context, h *dht.Host, id cid.Cid, count int) (*models.Retrieval, error)
}

type RetrievalState

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

func NewRetrievalState

func NewRetrievalState(h *dht.Host, contentID cid.Cid) *RetrievalState

func (*RetrievalState) ClosedStream

func (rs *RetrievalState) ClosedStream(network network.Network, stream network.Stream)

func (*RetrievalState) Connected

func (rs *RetrievalState) Connected(network network.Network, conn network.Conn)

func (*RetrievalState) DialEnded

func (rs *RetrievalState) DialEnded(trpt string, raddr ma.Multiaddr, p peer.ID, start time.Time, end time.Time, err error)

func (*RetrievalState) DialStarted

func (rs *RetrievalState) DialStarted(trpt string, raddr ma.Multiaddr, p peer.ID, start time.Time)

func (*RetrievalState) Disconnected

func (rs *RetrievalState) Disconnected(network network.Network, conn network.Conn)

func (*RetrievalState) Listen

func (rs *RetrievalState) Listen(network network.Network, multiaddr ma.Multiaddr)

func (*RetrievalState) ListenClose

func (rs *RetrievalState) ListenClose(network network.Network, multiaddr ma.Multiaddr)

func (*RetrievalState) OpenedStream

func (rs *RetrievalState) OpenedStream(network network.Network, stream network.Stream)

func (*RetrievalState) Register

func (rs *RetrievalState) Register(ctx context.Context) context.Context

func (*RetrievalState) Unregister

func (rs *RetrievalState) Unregister()

type RoutingTable

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

func (*RoutingTable) Find

func (*RoutingTable) FindAll

func (rts *RoutingTable) FindAll(ctx context.Context, hostID peer.ID) ([]*models.RoutingTableSnapshot, error)

func (*RoutingTable) FindByIDAndHostID

func (rts *RoutingTable) FindByIDAndHostID(ctx context.Context, id int, hostID peer.ID) (*models.RoutingTableSnapshot, error)

func (*RoutingTable) Save

func (*RoutingTable) SaveTxn

type RoutingTableListener

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

func NewRoutingTableListener

func NewRoutingTableListener(h *dht.Host) *RoutingTableListener

func (*RoutingTableListener) BuildUpdate

func (r *RoutingTableListener) BuildUpdate() types.RoutingTablePeers

func (*RoutingTableListener) OnClose

func (r *RoutingTableListener) OnClose()

func (*RoutingTableListener) PeerAdded

func (r *RoutingTableListener) PeerAdded(p peer.ID)

func (*RoutingTableListener) PeerRemoved

func (r *RoutingTableListener) PeerRemoved(p peer.ID)

func (*RoutingTableListener) SendFullUpdate

func (r *RoutingTableListener) SendFullUpdate()

func (*RoutingTableListener) Stop

func (r *RoutingTableListener) Stop()

func (*RoutingTableListener) Updates

func (r *RoutingTableListener) Updates() <-chan types.RoutingTableUpdate

type RoutingTableService

type RoutingTableService interface {
	Find(ctx context.Context, id int) (*models.RoutingTableSnapshot, error)
	FindAll(ctx context.Context, hostID peer.ID) ([]*models.RoutingTableSnapshot, error)
	FindByIDAndHostID(ctx context.Context, id int, hostID peer.ID) (*models.RoutingTableSnapshot, error)
	Save(ctx context.Context, exec boil.ContextExecutor, h *dht.Host) (*models.RoutingTableSnapshot, error)
	SaveTxn(ctx context.Context, h *dht.Host) (*models.RoutingTableSnapshot, error)
}

func NewRoutingTableService

func NewRoutingTableService(peerService PeerService, rtRepo repo.RoutingTableRepo) RoutingTableService

Jump to

Keyboard shortcuts

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