Documentation ¶
Index ¶
- Variables
- type Eth2Model
- func (p *Eth2Model) CheckPeersSummaryTableStatus(ctx context.Context, pool *pgxpool.Pool) bool
- func (p *Eth2Model) DeletePeer(ctx context.Context, pool *pgxpool.Pool, peerID string)
- func (p *Eth2Model) GetConnectedPeers(ctx context.Context, pool *pgxpool.Pool) ([]string, error)
- func (p *Eth2Model) GetLastActivityTime(ctx context.Context, pool *pgxpool.Pool) (time.Time, error)
- func (p *Eth2Model) GetNumberOfPeers(ctx context.Context, pool *pgxpool.Pool) (int, error)
- func (p *Eth2Model) GetPeers(ctx context.Context, pool *pgxpool.Pool) []peer.ID
- func (p *Eth2Model) LoadClientDiversitySnapshot(ctx context.Context, pool *pgxpool.Pool, qTime time.Time) (models.ClientDiversity, error)
- func (p *Eth2Model) LoadPeer(ctx context.Context, pool *pgxpool.Pool, peerID string) (models.Peer, bool)
- func (p *Eth2Model) StoreClientDiversitySnapshot(ctx context.Context, pool *pgxpool.Pool, cliDiver models.ClientDiversity) error
- func (p *Eth2Model) StorePeer(ctx context.Context, pool *pgxpool.Pool, peerID string, peer models.Peer)
- type IpfsModel
- func (p *IpfsModel) CheckPeersSummaryTableStatus(ctx context.Context, pool *pgxpool.Pool) bool
- func (p *IpfsModel) DeletePeer(ctx context.Context, pool *pgxpool.Pool, peerID string)
- func (p *IpfsModel) GetConnectedPeers(ctx context.Context, pool *pgxpool.Pool) ([]string, error)
- func (p *IpfsModel) GetLastActivityTime(ctx context.Context, pool *pgxpool.Pool) (time.Time, error)
- func (p *IpfsModel) GetNumberOfPeers(ctx context.Context, pool *pgxpool.Pool) (int, error)
- func (p *IpfsModel) GetPeers(ctx context.Context, pool *pgxpool.Pool) []peer.ID
- func (p *IpfsModel) LoadClientDiversitySnapshot(ctx context.Context, pool *pgxpool.Pool, qTime time.Time) (models.ClientDiversity, error)
- func (p *IpfsModel) LoadPeer(ctx context.Context, pool *pgxpool.Pool, peerID string) (models.Peer, bool)
- func (p *IpfsModel) StoreClientDiversitySnapshot(ctx context.Context, pool *pgxpool.Pool, cliDiver models.ClientDiversity) error
- func (p *IpfsModel) StorePeer(ctx context.Context, pool *pgxpool.Pool, peerID string, peer models.Peer)
- type NetworkModel
- type PostgresDBService
- func (p *PostgresDBService) CheckPeersSummaryTableStatus() bool
- func (p *PostgresDBService) Close()
- func (p *PostgresDBService) DeletePeer(id string)
- func (p *PostgresDBService) GetConnectedPeers() ([]string, error)
- func (p *PostgresDBService) GetLastActivityTime() (time.Time, error)
- func (p *PostgresDBService) GetNumberOfPeers() (int, error)
- func (p *PostgresDBService) GetPeers() []peer.ID
- func (p *PostgresDBService) LoadClientDiversitySnapshot(qTime time.Time) (models.ClientDiversity, error)
- func (p *PostgresDBService) LoadPeer(id string) (models.Peer, bool)
- func (p *PostgresDBService) StoreClientDiversitySnapshot(cliDiver models.ClientDiversity) error
- func (p *PostgresDBService) StorePeer(id string, pm models.Peer)
Constants ¶
This section is empty.
Variables ¶
var (
// logrus associated with the postgres db
PsqlType = "postgres-db"
)
Static postgres queries, for each modification in the tables, the table needs to be reseted
Functions ¶
This section is empty.
Types ¶
type Eth2Model ¶
type Eth2Model struct {
Network string
}
func NewEth2Model ¶
func (*Eth2Model) CheckPeersSummaryTableStatus ¶
func (*Eth2Model) DeletePeer ¶
func (*Eth2Model) GetConnectedPeers ¶
func (*Eth2Model) GetLastActivityTime ¶
func (*Eth2Model) GetNumberOfPeers ¶
func (*Eth2Model) LoadClientDiversitySnapshot ¶
func (p *Eth2Model) LoadClientDiversitySnapshot(ctx context.Context, pool *pgxpool.Pool, qTime time.Time) (models.ClientDiversity, error)
So far not used since it's just for exporting Doesn't make much sense to add it to the crawler (no idea why would we need to access the snapshot of a given time)
func (*Eth2Model) StoreClientDiversitySnapshot ¶
type IpfsModel ¶
type IpfsModel struct {
Network string
}
func NewIpfsPeerModel ¶
func (*IpfsModel) CheckPeersSummaryTableStatus ¶
func (*IpfsModel) DeletePeer ¶
func (*IpfsModel) GetConnectedPeers ¶
func (*IpfsModel) GetLastActivityTime ¶
func (*IpfsModel) GetNumberOfPeers ¶
func (*IpfsModel) LoadClientDiversitySnapshot ¶
func (p *IpfsModel) LoadClientDiversitySnapshot(ctx context.Context, pool *pgxpool.Pool, qTime time.Time) (models.ClientDiversity, error)
So far not used since it's just for exporting Doesn't make much sense to add it to the crawler (no idea why would we need to access the snapshot of a given time)
func (*IpfsModel) StoreClientDiversitySnapshot ¶
type NetworkModel ¶
type NetworkModel interface { // Peer model related StorePeer(context.Context, *pgxpool.Pool, string, models.Peer) LoadPeer(context.Context, *pgxpool.Pool, string) (models.Peer, bool) DeletePeer(context.Context, *pgxpool.Pool, string) GetPeers(context.Context, *pgxpool.Pool) []peer.ID CheckPeersSummaryTableStatus(context.Context, *pgxpool.Pool) bool GetConnectedPeers(context.Context, *pgxpool.Pool) ([]string, error) GetNumberOfPeers(context.Context, *pgxpool.Pool) (int, error) GetLastActivityTime(context.Context, *pgxpool.Pool) (time.Time, error) // Client diversity related model StoreClientDiversitySnapshot(context.Context, *pgxpool.Pool, models.ClientDiversity) error LoadClientDiversitySnapshot(context.Context, *pgxpool.Pool, time.Time) (models.ClientDiversity, error) // contains filtered or unexported methods }
type PostgresDBService ¶
type PostgresDBService struct {
// contains filtered or unexported fields
}
func ConnectToDB ¶
func ConnectToDB(ctx context.Context, url string, dbmodel NetworkModel) (*PostgresDBService, error)
Connect to the PostgreSQL Database and get the multithread-proof connection from the given url-composed credentials
func (*PostgresDBService) CheckPeersSummaryTableStatus ¶
func (p *PostgresDBService) CheckPeersSummaryTableStatus() bool
Close the connection with the PostgreSQL
func (*PostgresDBService) Close ¶
func (p *PostgresDBService) Close()
Close the connection with the PostgreSQL
func (*PostgresDBService) DeletePeer ¶
func (p *PostgresDBService) DeletePeer(id string)
Close the connection with the PostgreSQL
func (*PostgresDBService) GetConnectedPeers ¶
func (p *PostgresDBService) GetConnectedPeers() ([]string, error)
Close the connection with the PostgreSQL
func (*PostgresDBService) GetLastActivityTime ¶
func (p *PostgresDBService) GetLastActivityTime() (time.Time, error)
Close the connection with the PostgreSQL
func (*PostgresDBService) GetNumberOfPeers ¶
func (p *PostgresDBService) GetNumberOfPeers() (int, error)
Close the connection with the PostgreSQL
func (*PostgresDBService) GetPeers ¶
func (p *PostgresDBService) GetPeers() []peer.ID
Close the connection with the PostgreSQL
func (*PostgresDBService) LoadClientDiversitySnapshot ¶
func (p *PostgresDBService) LoadClientDiversitySnapshot(qTime time.Time) (models.ClientDiversity, error)
Close the connection with the PostgreSQL
func (*PostgresDBService) LoadPeer ¶
func (p *PostgresDBService) LoadPeer(id string) (models.Peer, bool)
Close the connection with the PostgreSQL
func (*PostgresDBService) StoreClientDiversitySnapshot ¶
func (p *PostgresDBService) StoreClientDiversitySnapshot(cliDiver models.ClientDiversity) error
Close the connection with the PostgreSQL