postgresql

package
v0.3.1 Latest Latest
Warning

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

Go to latest
Published: Jan 5, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

Package postgresql provides a postgresql implementation of the probe database.

Index

Constants

This section is empty.

Variables

View Source
var (
	// ErrNoTransaction is returned when an attempt to carry out a mutation to the database
	// is not inside a transaction.
	ErrNoTransaction = errors.New("no transaction for action")
)

Functions

This section is empty.

Types

type Parameter

type Parameter interface {
	// contains filtered or unexported methods
}

Parameter is the interface for service parameters.

func WithCACert

func WithCACert(cert []byte) Parameter

WithCACert sets the bytes of the certificate authority TLS certificate.

func WithClientCert

func WithClientCert(cert []byte) Parameter

WithClientCert sets the bytes of the client TLS certificate.

func WithClientKey

func WithClientKey(key []byte) Parameter

WithClientKey sets the bytes of the client TLS key.

func WithLogLevel

func WithLogLevel(logLevel zerolog.Level) Parameter

WithLogLevel sets the log level for the module.

func WithPassword

func WithPassword(password string) Parameter

WithPassword sets the password for this module.

func WithPort

func WithPort(port int32) Parameter

WithPort sets the port for this module.

func WithServer

func WithServer(server string) Parameter

WithServer sets the server for this module.

func WithUser

func WithUser(user string) Parameter

WithUser sets the user for this module.

type Service

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

Service is a chain database service.

func New

func New(ctx context.Context, params ...Parameter) (*Service, error)

New creates a new service.

func (*Service) AggregateAttestations added in v0.3.1

func (s *Service) AggregateAttestations(
	ctx context.Context,
	filter *probedb.AggregateAttestationFilter,
) (
	[]*probedb.AggregateAttestation,
	error,
)

AggregateAttestations obtains the aggregate attestations for a given filter.

func (*Service) AttestationSummaries added in v0.3.1

func (s *Service) AttestationSummaries(ctx context.Context,
	filter *probedb.AttestationSummaryFilter,
) (
	[]*probedb.AttestationSummary,
	error,
)

AttestationSummaries obtains the attestation summaries for a filter.

func (*Service) BeginTx

BeginTx begins a transaction on the database. The transaction can be rolled back by invoking the cancel function.

func (*Service) BlockDelays

func (s *Service) BlockDelays(
	ctx context.Context,
	filter *probedb.DelayFilter,
) (
	[]*probedb.Delay,
	error,
)

BlockDelays obtains the block delays for a range of slots.

func (*Service) CommitTx

func (s *Service) CommitTx(ctx context.Context) error

CommitTx commits a transaction on the ops datastore.

func (*Service) HeadDelays

func (s *Service) HeadDelays(
	ctx context.Context,
	filter *probedb.DelayFilter,
) (
	[]*probedb.Delay,
	error,
)

HeadDelays obtains the head delays for a range of slots.

func (*Service) Init

func (s *Service) Init(ctx context.Context) error

Init initialises the database.

func (*Service) Metadata

func (s *Service) Metadata(ctx context.Context, key string) ([]byte, error)

Metadata obtains the JSON value from a metadata key.

func (*Service) SetAggregateAttestation added in v0.3.1

func (s *Service) SetAggregateAttestation(ctx context.Context, aggregateAttestation *probedb.AggregateAttestation) error

SetAggregateAttestation sets an aggregate attestation. If an aggregate attestation already exists then ignore it.

func (*Service) SetAttestationSummary added in v0.3.1

func (s *Service) SetAttestationSummary(ctx context.Context, summary *probedb.AttestationSummary) error

SetAttestationSummary sets an attestation summary.

func (*Service) SetBlockDelay

func (s *Service) SetBlockDelay(ctx context.Context, delay *probedb.Delay) error

SetBlockDelay sets a block delay. If a delay already exists for this block then ignore it.

func (*Service) SetHeadDelay

func (s *Service) SetHeadDelay(ctx context.Context, delay *probedb.Delay) error

SetHeadDelay sets a head delay. If a delay already exists for this head then ignore it.

func (*Service) SetMetadata

func (s *Service) SetMetadata(ctx context.Context, key string, value []byte) error

SetMetadata sets a metadata key to a JSON value.

func (*Service) Upgrade

func (s *Service) Upgrade(ctx context.Context) error

Upgrade upgrades the database.

type Tx

type Tx struct{}

Tx is a context tag for the database transaction.

Jump to

Keyboard shortcuts

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