Documentation ¶
Index ¶
- Variables
- func NetError(err error) string
- func Rollback(txn *sql.Tx)
- type Client
- type DBClient
- func (c *DBClient) Close() error
- func (c *DBClient) FetchDueOpenSessions(ctx context.Context) (models.SessionsOpenSlice, error)
- func (c *DBClient) FetchUnresolvedMultiAddresses(ctx context.Context, limit int) (models.MultiAddressSlice, error)
- func (c *DBClient) GetOrCreateAgentVersionID(ctx context.Context, exec boil.ContextExecutor, agentVersion string) (*int, error)
- func (c *DBClient) GetOrCreateProtocol(ctx context.Context, exec boil.ContextExecutor, protocol string) (*int, error)
- func (c *DBClient) GetOrCreateProtocolsSetID(ctx context.Context, exec boil.ContextExecutor, protocols []string) (*int, error)
- func (c *DBClient) Handle() *sql.DB
- func (c *DBClient) InitCrawl(ctx context.Context) (*models.Crawl, error)
- func (c *DBClient) PersistCrawlProperties(ctx context.Context, crawl *models.Crawl, properties map[string]map[string]int) error
- func (c *DBClient) PersistCrawlVisit(ctx context.Context, crawlID int, peerID peer.ID, maddrs []ma.Multiaddr, ...) (*InsertVisitResult, error)
- func (c *DBClient) PersistDialVisit(peerID peer.ID, maddrs []ma.Multiaddr, dialDuration time.Duration, ...) (*InsertVisitResult, error)
- func (c *DBClient) PersistNeighbors(ctx context.Context, crawl *models.Crawl, dbPeerID *int, peerID peer.ID, ...) error
- func (c *DBClient) QueryBootstrapPeers(ctx context.Context, limit int) ([]peer.AddrInfo, error)
- func (c *DBClient) UpdateCrawl(ctx context.Context, crawl *models.Crawl) error
- func (c *DBClient) UpsertPeer(mh string, agentVersionID null.Int, protocolSetID null.Int, ...) (int, error)
- type InsertVisitResult
- type JSONClient
- func (c *JSONClient) InitCrawl(ctx context.Context) (*models.Crawl, error)
- func (c *JSONClient) PersistCrawlProperties(ctx context.Context, crawl *models.Crawl, properties map[string]map[string]int) error
- func (c *JSONClient) PersistCrawlVisit(ctx context.Context, crawlID int, peerID peer.ID, maddrs []ma.Multiaddr, ...) (*InsertVisitResult, error)
- func (c *JSONClient) PersistNeighbors(ctx context.Context, crawl *models.Crawl, dbPeerID *int, peerID peer.ID, ...) error
- func (c *JSONClient) QueryBootstrapPeers(ctx context.Context, limit int) ([]peer.AddrInfo, error)
- func (c *JSONClient) UpdateCrawl(ctx context.Context, crawl *models.Crawl) error
- type JSONNeighbors
- type JSONVisit
Constants ¶
This section is empty.
Variables ¶
View Source
var ( ErrEmptyAgentVersion = fmt.Errorf("empty agent version") ErrEmptyProtocol = fmt.Errorf("empty protocol") ErrEmptyProtocolsSet = fmt.Errorf("empty protocols set") )
View Source
var KnownErrors = map[string]string{ models.NetErrorIoTimeout: "i/o timeout", models.NetErrorNoRecentNetworkActivity: "no recent network activity", models.NetErrorConnectionRefused: "connection refused", models.NetErrorProtocolNotSupported: "protocol not supported", models.NetErrorPeerIDMismatch: "peer id mismatch", models.NetErrorNoRouteToHost: "no route to host", models.NetErrorNetworkUnreachable: "network is unreachable", models.NetErrorNoGoodAddresses: "no good addresses", models.NetErrorContextDeadlineExceeded: "context deadline exceeded", models.NetErrorNoPublicIP: "no public IP address", models.NetErrorMaxDialAttemptsExceeded: "max dial attempts exceeded", models.NetErrorHostIsDown: "host is down", models.NetErrorStreamReset: "stream reset", models.NetErrorNegotiateSecurityProtocol: "failed to negotiate security protocol", models.NetErrorNegotiateStreamMultiplexer: "failed to negotiate stream multiplexer", models.NetErrorResourceLimitExceeded: "resource limit exceeded", models.NetErrorWriteOnStream: "Write on stream", }
KnownErrors contains a list of known errors. Property key + string to match for
Functions ¶
Types ¶
type Client ¶
type Client interface { QueryBootstrapPeers(ctx context.Context, limit int) ([]peer.AddrInfo, error) InitCrawl(ctx context.Context) (*models.Crawl, error) UpdateCrawl(ctx context.Context, crawl *models.Crawl) error PersistCrawlProperties(ctx context.Context, crawl *models.Crawl, properties map[string]map[string]int) error PersistCrawlVisit(ctx context.Context, crawlID int, peerID peer.ID, maddrs []ma.Multiaddr, protocols []string, agentVersion string, connectDuration time.Duration, crawlDuration time.Duration, visitStartedAt time.Time, visitEndedAt time.Time, connectErrorStr string, crawlErrorStr string, isExposed null.Bool) (*InsertVisitResult, error) PersistNeighbors(ctx context.Context, crawl *models.Crawl, dbPeerID *int, peerID peer.ID, errorBits uint16, dbNeighborsIDs []int, neighbors []peer.ID) error }
type DBClient ¶
type DBClient struct {
// contains filtered or unexported fields
}
func InitDBClient ¶
InitDBClient establishes a database connection with the provided configuration and applies any pending migrations
func (*DBClient) FetchDueOpenSessions ¶
FetchDueOpenSessions fetches all open sessions from the database that are due.
func (*DBClient) FetchUnresolvedMultiAddresses ¶
func (c *DBClient) FetchUnresolvedMultiAddresses(ctx context.Context, limit int) (models.MultiAddressSlice, error)
FetchUnresolvedMultiAddresses fetches all multi addresses that were not resolved yet.
func (*DBClient) GetOrCreateAgentVersionID ¶
func (*DBClient) GetOrCreateProtocol ¶
func (*DBClient) GetOrCreateProtocolsSetID ¶
func (*DBClient) InitCrawl ¶
InitCrawl inserts a crawl instance into the database in the state `started`. This is done to receive a database ID that all subsequent database entities can be linked to.
func (*DBClient) PersistCrawlProperties ¶
func (*DBClient) PersistCrawlVisit ¶
func (c *DBClient) PersistCrawlVisit( ctx context.Context, crawlID int, peerID peer.ID, maddrs []ma.Multiaddr, protocols []string, agentVersion string, connectDuration time.Duration, crawlDuration time.Duration, visitStartedAt time.Time, visitEndedAt time.Time, connectErrorStr string, crawlErrorStr string, isExposed null.Bool, ) (*InsertVisitResult, error)
func (*DBClient) PersistDialVisit ¶
func (*DBClient) PersistNeighbors ¶
func (*DBClient) QueryBootstrapPeers ¶
func (*DBClient) UpdateCrawl ¶
UpdateCrawl takes the crawl model an updates it in the database.
type InsertVisitResult ¶
func (*InsertVisitResult) Scan ¶
func (ivr *InsertVisitResult) Scan(value interface{}) error
type JSONClient ¶
type JSONClient struct {
// contains filtered or unexported fields
}
func (*JSONClient) PersistCrawlProperties ¶
func (*JSONClient) PersistCrawlVisit ¶
func (c *JSONClient) PersistCrawlVisit(ctx context.Context, crawlID int, peerID peer.ID, maddrs []ma.Multiaddr, protocols []string, agentVersion string, connectDuration time.Duration, crawlDuration time.Duration, visitStartedAt time.Time, visitEndedAt time.Time, connectErrorStr string, crawlErrorStr string, isExposed null.Bool) (*InsertVisitResult, error)
func (*JSONClient) PersistNeighbors ¶
func (*JSONClient) QueryBootstrapPeers ¶
func (*JSONClient) UpdateCrawl ¶
type JSONNeighbors ¶
Click to show internal directories.
Click to hide internal directories.