Documentation
¶
Index ¶
- Variables
- func DHTHostConfigFromNetworkConfig(hostCfg *config.CommonDHTHostOpts, netCfg *config.NetworkConfiguration)
- func ListPeerIDsFromAddrsInfos(addrs []peer.AddrInfo) []peer.ID
- func ParseAminoDHTHostMode(mode config.DHTHostType) kaddht.ModeOpt
- func ResolveDNS(ctx context.Context, _ DHTHost, task SamplingTask, timeout time.Duration) (models.GeneralVisit, error)
- func ResolveDNSLink(ctx context.Context, domain string, timeout time.Duration) (string, error)
- func ResolveIPNSRecord(ctx context.Context, h DHTHost, task SamplingTask, timeout time.Duration) (models.GeneralVisit, error)
- func SampleByFindPeerInfo(ctx context.Context, h DHTHost, task SamplingTask, timeout time.Duration) (models.GeneralVisit, error)
- func SampleByFindPeers(ctx context.Context, h DHTHost, task SamplingTask, timeout time.Duration) (models.GeneralVisit, error)
- func SampleByFindProviders(ctx context.Context, h DHTHost, task SamplingTask, timeout time.Duration) (models.GeneralVisit, error)
- func SampleByFindValue(ctx context.Context, h DHTHost, task SamplingTask, timeout time.Duration) (models.GeneralVisit, error)
- type DHTHost
- type Daemon
- type DataSampler
- type NetworkScrapper
- type SamplerFunction
- type SamplingTask
Constants ¶
This section is empty.
Variables ¶
View Source
var DefaulDaemonConfig = config.AkaiDaemonConfig{}
View Source
var DefaultDHTHostOpts = &config.CommonDHTHostOpts{ ID: 0, IP: "0.0.0.0", Port: 9020, DialTimeout: 10 * time.Second, HostType: config.UnknownHostType, DHTMode: config.DHTUknownType, AgentVersion: config.ComposeAkaiAgentVersion(), Meter: otel.GetMeterProvider().Meter("akai_host"), }
View Source
var DefaultDataSamplerConfig = &config.AkaiDataSamplerConfig{ Network: config.DefaultNetwork.String(), Workers: 1000, SamplingTimeout: 10 * time.Second, DBsyncInterval: 10 * time.Minute, Meter: otel.GetMeterProvider().Meter("akai_data_sampler"), }
Functions ¶
func DHTHostConfigFromNetworkConfig ¶
func DHTHostConfigFromNetworkConfig(hostCfg *config.CommonDHTHostOpts, netCfg *config.NetworkConfiguration)
func ParseAminoDHTHostMode ¶
func ParseAminoDHTHostMode(mode config.DHTHostType) kaddht.ModeOpt
func ResolveDNS ¶
func ResolveDNS( ctx context.Context, _ DHTHost, task SamplingTask, timeout time.Duration, ) (models.GeneralVisit, error)
func ResolveDNSLink ¶
func ResolveIPNSRecord ¶
func ResolveIPNSRecord( ctx context.Context, h DHTHost, task SamplingTask, timeout time.Duration, ) (models.GeneralVisit, error)
func SampleByFindPeerInfo ¶
func SampleByFindPeerInfo( ctx context.Context, h DHTHost, task SamplingTask, timeout time.Duration, ) (models.GeneralVisit, error)
func SampleByFindPeers ¶
func SampleByFindPeers( ctx context.Context, h DHTHost, task SamplingTask, timeout time.Duration, ) (models.GeneralVisit, error)
func SampleByFindProviders ¶
func SampleByFindProviders( ctx context.Context, h DHTHost, task SamplingTask, timeout time.Duration, ) (models.GeneralVisit, error)
logical sampler functions
func SampleByFindValue ¶
func SampleByFindValue( ctx context.Context, h DHTHost, task SamplingTask, timeout time.Duration, ) (models.GeneralVisit, error)
Types ¶
type DHTHost ¶
type DHTHost interface {
IntenalID() int
Host() host.Host
FindClosestPeers(context.Context, string, time.Duration) (time.Duration, []peer.ID, error)
FindProviders(context.Context, cid.Cid, time.Duration) (time.Duration, []peer.AddrInfo, error)
FindPeers(context.Context, string, time.Duration) (time.Duration, []peer.AddrInfo, error)
FindPeer(context.Context, peer.ID, time.Duration) (time.Duration, peer.AddrInfo, error)
FindValue(context.Context, string, time.Duration) (time.Duration, []byte, error)
FindQuorumValue(context.Context, string, time.Duration, int) (time.Duration, [][]byte, error)
PutValue(context.Context, string, []byte, time.Duration) (time.Duration, error)
ConnectAndIdentifyPeer(context.Context, peer.AddrInfo, int, time.Duration) (map[string]any, error)
}
func NewDHTHost ¶
func NewDHTHost(ctx context.Context, networkConfig *config.NetworkConfiguration, commonCfg *config.CommonDHTHostOpts) (DHTHost, error)
type Daemon ¶
type Daemon struct {
// contains filtered or unexported fields
}
func NewDaemon ¶
func NewDaemon( cfg config.AkaiDaemonConfig, h DHTHost, dbServ db.Database, dataSampler *DataSampler, netScrapper NetworkScrapper, ) (*Daemon, error)
TODO: remove the API from the Daemon, and add it perhaps to the Network specifics
type DataSampler ¶
type DataSampler struct {
// contains filtered or unexported fields
}
func NewDataSampler ¶
func NewDataSampler( cfg *config.AkaiDataSamplerConfig, database db.Database, netScrapper NetworkScrapper, h DHTHost, ) (*DataSampler, error)
type NetworkScrapper ¶
type NetworkScrapper interface {
GetSamplingItemStream() chan []*models.SamplingItem
SyncWithDatabase(context.Context) ([]*models.SamplingItem, error)
GetQuorum() int
Serve(context.Context) error
Close(context.Context) error
}
NetworkScrapper is the main interface that each of the network should follow in order to provide new items to the daemon for periodic sampling
type SamplerFunction ¶
type SamplerFunction func( context.Context, DHTHost, SamplingTask, time.Duration) (models.GeneralVisit, error)
type SamplingTask ¶
type SamplingTask struct {
VisitRound int
Item *models.SamplingItem
Quorum int
}
TODO: in the future, this could be extended to make a "smarter" division of the tasks: - key-space filltering - host selection - or similars
Click to show internal directories.
Click to hide internal directories.