Documentation
¶
Index ¶
- func SelectQuery(tableName string) string
- type AggSenderSQLStorage
- func (a *AggSenderSQLStorage) DeleteCertificate(ctx context.Context, certificateID common.Hash) error
- func (a *AggSenderSQLStorage) GetCertificateByHeight(height uint64) (*types.Certificate, error)
- func (a *AggSenderSQLStorage) GetCertificateHeaderByHeight(height uint64) (*types.CertificateHeader, error)
- func (a *AggSenderSQLStorage) GetCertificateHeadersByStatus(statuses []agglayertypes.CertificateStatus) ([]*types.CertificateHeader, error)
- func (a *AggSenderSQLStorage) GetLastSentCertificate() (*types.Certificate, error)
- func (a *AggSenderSQLStorage) GetLastSentCertificateHeader() (*types.CertificateHeader, error)
- func (a *AggSenderSQLStorage) GetLastSentCertificateHeaderWithProofIfInError(ctx context.Context) (*types.CertificateHeader, *types.AggchainProof, error)
- func (a *AggSenderSQLStorage) GetNonAcceptedCertificate() (*NonAcceptedCertificate, error)
- func (a *AggSenderSQLStorage) SaveLastSentCertificate(ctx context.Context, certificate types.Certificate) error
- func (a *AggSenderSQLStorage) SaveNonAcceptedCertificate(ctx context.Context, nonAcceptedCert *NonAcceptedCertificate) error
- func (a *AggSenderSQLStorage) UpdateCertificateStatus(ctx context.Context, certificateID common.Hash, ...) error
- type AggSenderSQLStorageConfig
- type AggSenderStorage
- type AggchainProofMeddler
- type NonAcceptedCertificate
- type RuntimeData
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SelectQuery ¶ added in v0.4.0
SelectQuery generates a SELECT query string for the CertificateHeader fields using reflection
Types ¶
type AggSenderSQLStorage ¶
type AggSenderSQLStorage struct {
dbtypes.KeyValueStorager
// contains filtered or unexported fields
}
AggSenderSQLStorage is the struct that implements the AggSenderStorage interface
func NewAggSenderSQLStorage ¶
func NewAggSenderSQLStorage(logger *log.Logger, cfg AggSenderSQLStorageConfig) (*AggSenderSQLStorage, error)
NewAggSenderSQLStorage creates a new AggSenderSQLStorage
func (*AggSenderSQLStorage) DeleteCertificate ¶
func (a *AggSenderSQLStorage) DeleteCertificate(ctx context.Context, certificateID common.Hash) error
DeleteCertificate deletes a certificate from the storage
func (*AggSenderSQLStorage) GetCertificateByHeight ¶
func (a *AggSenderSQLStorage) GetCertificateByHeight(height uint64) (*types.Certificate, error)
GetCertificateByHeight returns a certificate by its height
func (*AggSenderSQLStorage) GetCertificateHeaderByHeight ¶ added in v0.4.0
func (a *AggSenderSQLStorage) GetCertificateHeaderByHeight(height uint64) (*types.CertificateHeader, error)
GetCertificateHeaderByHeight returns a certificate by its height
func (*AggSenderSQLStorage) GetCertificateHeadersByStatus ¶ added in v0.4.0
func (a *AggSenderSQLStorage) GetCertificateHeadersByStatus( statuses []agglayertypes.CertificateStatus) ([]*types.CertificateHeader, error)
GetCertificateHeadersByStatus returns a list of certificate headers by their status
func (*AggSenderSQLStorage) GetLastSentCertificate ¶
func (a *AggSenderSQLStorage) GetLastSentCertificate() (*types.Certificate, error)
GetLastSentCertificate returns the last certificate sent to the aggLayer
func (*AggSenderSQLStorage) GetLastSentCertificateHeader ¶ added in v0.4.0
func (a *AggSenderSQLStorage) GetLastSentCertificateHeader() (*types.CertificateHeader, error)
GetLastSentCertificateHeader returns the last certificate header sent to the aggLayer
func (*AggSenderSQLStorage) GetLastSentCertificateHeaderWithProofIfInError ¶ added in v0.4.0
func (a *AggSenderSQLStorage) GetLastSentCertificateHeaderWithProofIfInError( ctx context.Context) (*types.CertificateHeader, *types.AggchainProof, error)
GetLastSentCertificateHeaderWithProofIfInError returns the last certificate header sent to the aggLayer and the aggchain proof if the certificate is in error
func (*AggSenderSQLStorage) GetNonAcceptedCertificate ¶ added in v0.4.0
func (a *AggSenderSQLStorage) GetNonAcceptedCertificate() (*NonAcceptedCertificate, error)
GetNonAcceptedCertificates returns a list of non-accepted certificates
func (*AggSenderSQLStorage) SaveLastSentCertificate ¶
func (a *AggSenderSQLStorage) SaveLastSentCertificate(ctx context.Context, certificate types.Certificate) error
SaveLastSentCertificate saves the last certificate sent to the aggLayer
func (*AggSenderSQLStorage) SaveNonAcceptedCertificate ¶ added in v0.4.0
func (a *AggSenderSQLStorage) SaveNonAcceptedCertificate( ctx context.Context, nonAcceptedCert *NonAcceptedCertificate) error
SaveNonAcceptedCertificate saves a non-accepted certificate in the storage in the key-value table since we are only saving the last non-accepted certificate This is used to keep track of the last non-accepted certificate and to allow for debugging and analysis of why they were not accepted.
func (*AggSenderSQLStorage) UpdateCertificateStatus ¶ added in v0.4.0
func (a *AggSenderSQLStorage) UpdateCertificateStatus( ctx context.Context, certificateID common.Hash, newStatus agglayertypes.CertificateStatus, updatedAt uint32) error
UpdateCertificateStatus updates a certificate status in the storage
type AggSenderSQLStorageConfig ¶
AggSenderSQLStorageConfig is the configuration for the AggSenderSQLStorage
type AggSenderStorage ¶
type AggSenderStorage interface {
// GetCertificateByHeight returns a certificate by its height
GetCertificateByHeight(height uint64) (*types.Certificate, error)
// GetLastSentCertificate returns the last certificate sent to the aggLayer
GetLastSentCertificate() (*types.Certificate, error)
// SaveLastSentCertificate saves the last certificate sent to the aggLayer
SaveLastSentCertificate(ctx context.Context, certificate types.Certificate) error
// DeleteCertificate deletes a certificate from the storage
DeleteCertificate(ctx context.Context, certificateID common.Hash) error
// GetCertificateHeadersByStatus returns a list of certificate headers by their status
GetCertificateHeadersByStatus(status []agglayertypes.CertificateStatus) ([]*types.CertificateHeader, error)
// UpdateCertificateStatus updates certificate status in db
UpdateCertificateStatus(
ctx context.Context,
certificateID common.Hash,
newStatus agglayertypes.CertificateStatus,
updatedAt uint32) error
// GetLastSentCertificateHeader returns the last certificate header sent to the aggLayer
GetLastSentCertificateHeader() (*types.CertificateHeader, error)
// GetCertificateHeaderByHeight returns a certificate header by its height
GetCertificateHeaderByHeight(height uint64) (*types.CertificateHeader, error)
// GetLastSentCertificateHeaderWithProofIfInError returns the last certificate header sent to the aggLayer
// and the aggchain proof if the certificate is in error
GetLastSentCertificateHeaderWithProofIfInError(
ctx context.Context) (*types.CertificateHeader, *types.AggchainProof, error)
// SaveNonAcceptedCertificate saves a non-accepted certificate in the storage
SaveNonAcceptedCertificate(ctx context.Context, nonAcceptedCert *NonAcceptedCertificate) error
// GetNonAcceptedCertificate returns the last non-accepted certificate
GetNonAcceptedCertificate() (*NonAcceptedCertificate, error)
}
AggSenderStorage is the interface that defines the methods to interact with the storage
type AggchainProofMeddler ¶ added in v0.3.0
type AggchainProofMeddler struct{}
AggchainProofMeddler is a meddler.Meddler implementation for the AggchainProof type.
func (*AggchainProofMeddler) PostRead ¶ added in v0.3.0
func (m *AggchainProofMeddler) PostRead(fieldAddr interface{}, scanTarget interface{}) error
PostRead decodes the data from the database into the field.
func (*AggchainProofMeddler) PreRead ¶ added in v0.3.0
func (m *AggchainProofMeddler) PreRead(fieldAddr interface{}) (scanTarget interface{}, err error)
PreRead prepares the field for reading from the database.
func (*AggchainProofMeddler) PreWrite ¶ added in v0.3.0
func (m *AggchainProofMeddler) PreWrite(field interface{}) (saveValue interface{}, err error)
PreWrite prepares the field for writing to the database.
type NonAcceptedCertificate ¶ added in v0.4.0
type NonAcceptedCertificate struct {
Height uint64 `meddler:"height"`
SignedCertificate string `meddler:"signed_certificate"`
CreatedAt uint32 `meddler:"created_at"`
// Error message indicating why the certificate was not accepted
Error string `meddler:"error"`
}
func NewNonAcceptedCertificate ¶ added in v0.4.0
func NewNonAcceptedCertificate( cert *agglayertypes.Certificate, createdAt uint32, certError string) (*NonAcceptedCertificate, error)
type RuntimeData ¶ added in v0.2.0
type RuntimeData struct {
NetworkID uint32
}
func (RuntimeData) IsCompatible ¶ added in v0.2.0
func (r RuntimeData) IsCompatible(storage RuntimeData) error
func (RuntimeData) String ¶ added in v0.2.0
func (r RuntimeData) String() string