persistence

package
v1.0.12 Latest Latest
Warning

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

Go to latest
Published: Nov 28, 2024 License: GPL-3.0 Imports: 11 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrCannonLocationNotFound = errors.New("cannon location not found")

Functions

This section is empty.

Types

type AvailableExecutionNodeRecord

type AvailableExecutionNodeRecord struct {
	Enr             string    `db:"enr"`
	ExecutionCount  int64     `db:"execution_count"`
	LastConnectTime time.Time `db:"last_connect_time"`
}

type Client

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

func NewClient

func NewClient(ctx context.Context, log logrus.FieldLogger, conf *Config) (*Client, error)

func (*Client) CheckoutStalledExecutionNodeRecords

func (c *Client) CheckoutStalledExecutionNodeRecords(ctx context.Context, limit int) ([]*node.Record, error)

func (*Client) GetCannonLocationByID

func (c *Client) GetCannonLocationByID(ctx context.Context, id int64) (*cannon.Location, error)

func (*Client) GetCannonLocationByNetworkIDAndType

func (c *Client) GetCannonLocationByNetworkIDAndType(ctx context.Context, networkID, typ string) (*cannon.Location, error)

get by network id and type

func (*Client) InsertNodeRecordExecution

func (c *Client) InsertNodeRecordExecution(ctx context.Context, record *node.Execution) error

func (*Client) InsertNodeRecords

func (c *Client) InsertNodeRecords(ctx context.Context, records []*node.Record) error

func (*Client) ListAvailableExecutionNodeRecords

func (c *Client) ListAvailableExecutionNodeRecords(ctx context.Context, clientID string, ignoredNodeRecords []string, networkIds []uint64, forkIDHashes [][]byte, capabilities []string, limit int) ([]*string, error)

func (*Client) ListNodeRecordExecutions

func (c *Client) ListNodeRecordExecutions(ctx context.Context, networkIds []uint64, forkIDHashes [][]byte, limit int) ([]*node.Execution, error)

func (*Client) Start

func (c *Client) Start(ctx context.Context) error

func (*Client) Stop

func (c *Client) Stop(ctx context.Context) error

func (*Client) UpdateNodeRecord

func (c *Client) UpdateNodeRecord(ctx context.Context, record *node.Record) error

func (*Client) UpsertCannonLocation

func (c *Client) UpsertCannonLocation(ctx context.Context, location *cannon.Location) error

func (*Client) UpsertNodeRecordActivities

func (c *Client) UpsertNodeRecordActivities(ctx context.Context, activities []*node.Activity) error

type Config

type Config struct {
	Enabled          bool       `yaml:"enabled" default:"false"`
	ConnectionString string     `yaml:"connectionString"`
	DriverName       DriverName `yaml:"driverName"`
	MaxIdleConns     int        `yaml:"maxIdleConns" default:"2"`
	MaxOpenConns     int        `yaml:"maxOpenConns" default:"0"`
}

func (*Config) Validate

func (e *Config) Validate() error

type DriverName

type DriverName string
var (
	DriverNamePostgres DriverName = "postgres"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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