interfaces

package
v1.0.10-0...-7349ede Latest Latest
Warning

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

Go to latest
Published: Sep 20, 2023 License: MIT Imports: 6 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Client

type Client interface {
	// GetGRPCConn returns a configured GRPC connection
	GetGRPCConn() *grpc.ClientConn
	// NotifyShutdown sends a notification to the channel when connection has errors
	NotifyShutdown(ctx context.Context, stopChannel chan<- struct{}, waitForStateChange time.Duration)
}

Client represents a connection to the Platform

type ConnectionManager

type ConnectionManager interface {
	Starter
	Stopper
}

ConnectionManager represents management of connection to Platform

type Controller

type Controller interface {
	Starter
	Stopper
	// Save information about saved jetdrops
	SetJetDropData(pulse types.Pulse, jetID string)
}

Controller tracks drops integrity and makes calls to reload data

type JetDropsExtractor

type JetDropsExtractor interface {
	Starter
	Stopper
	// GetJetDrops stores JetDrop data in the main JetDrop channel
	GetJetDrops(ctx context.Context) <-chan *types.PlatformPulseData
	// LoadJetDrops loads JetDrop data between pulse numbers: (fromPulseNumber, toPulseNumber]
	LoadJetDrops(ctx context.Context, fromPulseNumber int64, toPulseNumber int64) error
}

JetDropsExtractor represents the main functions of working with Platform

type Processor

type Processor interface {
	Starter
	Stopper
}

Processor saves canonical data to database

type PulseExtractor

type PulseExtractor interface {
	// GetCurrentPulse returns the current Pulse number
	GetCurrentPulse(ctx context.Context) (uint32, error)
	// GetNextFinalizedPulse requests full pulse info
	GetNextFinalizedPulse(ctx context.Context, p int64) (*exporter.FullPulse, error)
}

PulseExtractor represents the methods for getting Pulse

type Starter

type Starter interface {
	// Start starts the main thread
	Start(ctx context.Context) error
}

type Stopper

type Stopper interface {
	// Stops stops the main thread
	Stop(ctx context.Context) error
}

type Storage

Storage manipulates data in database

type StorageAPIFetcher

type StorageAPIFetcher interface {
	// GetRecord returns record with provided reference from db.
	GetRecord(ref models.Reference) (models.Record, error)
	// GetPulse returns pulse with provided pulse number from db.
	GetPulse(pulseNumber int64) (models.Pulse, error)
	// GetPulse returns pulses from db.
	GetPulses(fromPulse *int64, timestampLte, timestampGte, pulseNumberLte, pulseNumberLt, pulseNumberGte, pulseNumberGt *int64, sortByAsc bool, limit, offset int) ([]models.Pulse, int, error)
	// GetJetDropsWithParams returns jetDrops for provided pulse with limit and offset.
	GetJetDropsWithParams(pulse models.Pulse, fromJetDropID *models.JetDropID, limit int, offset int) ([]models.JetDrop, int, error)
	// GetJetDropByID returns JetDrop by JetDropID, with slices of previous jetDrops and next jetDrops.
	GetJetDropByID(id models.JetDropID) (models.JetDrop, []models.JetDrop, []models.JetDrop, error)
	// GetJetDropsByJetID returns jetDrops for provided jetID sorting and filtering by pulseNumber.
	GetJetDropsByJetID(jetID string, pulseNumberLte, pulseNumberLt, pulseNumberGte, pulseNumberGt *int64, limit int, sortByPnAsc bool) ([]models.JetDrop, int, error)
	// GetLifeline returns records for provided object reference, ordered by desc by pulse number and order fields.
	GetLifeline(objRef []byte, fromIndex *string, pulseNumberLt, pulseNumberGt, timestampLte, timestampGte *int64, limit, offset int, sortByIndexAsc bool) ([]models.Record, int, error)
	// GetRecordsByJetDrop returns records for provided jet drop, ordered by order field.
	GetRecordsByJetDrop(jetDropID models.JetDropID, fromIndex, recordType *string, limit, offset int) ([]models.Record, int, error)
	// GetNextSavedPulse returns first pulse with pulse number bigger then fromPulseNumber from db.
	GetNextSavedPulse(fromPulseNumber models.Pulse, completedOnly bool) (models.Pulse, error)
	// GetJetDrops returns jetDrops for provided pulse from db.
	GetJetDrops(pulse models.Pulse) ([]models.JetDrop, error)
}

StorageAPIFetcher gets data from database

type StorageExporterFetcher

type StorageExporterFetcher interface {
	GetNextCompletePulseFilterByPrototypeReference(prevPulse int64, prototypes [][]byte) (models.Pulse, error)
}

StorageExporterFetcher represents the methods for exporter-api

type StorageFetcher

type StorageFetcher interface {
	// GetIncompletePulses returns pulses that are not complete from db.
	GetIncompletePulses() ([]models.Pulse, error)
	// GetSequentialPulse returns max pulse that have is_sequential as true from db.
	GetSequentialPulse() (models.Pulse, error)
	// GetPulseByPrev returns pulse with provided prev pulse number from db.
	GetPulseByPrev(prevPulse models.Pulse) (models.Pulse, error)
	// GetNextSavedPulse returns first pulse with pulse number bigger then fromPulseNumber from db.
	GetNextSavedPulse(fromPulseNumber models.Pulse, completedOnly bool) (models.Pulse, error)
	// GetJetDrops returns jetDrops for provided pulse from db.
	GetJetDrops(pulse models.Pulse) ([]models.JetDrop, error)
}

type StorageSetter

type StorageSetter interface {
	// SaveJetDropData saves provided jetDrop and records to db in one transaction.
	// increase jet_drop_amount and record_amount
	SaveJetDropData(jetDrop models.JetDrop, records []models.Record, pulseNumber int64) error
	// SavePulse saves provided pulse to db.
	SavePulse(pulse models.Pulse) error
	// CompletePulse update pulse with provided number to completeness in db.
	CompletePulse(pulseNumber int64) error
	// SequencePulse update pulse with provided number to sequential in db.
	SequencePulse(pulseNumber int64) error
}

StorageSetter saves data to database

type Transformer

type Transformer interface {
	Starter
	Stopper
	// GetJetDropsChannel returns the channel where canonical data will be stored
	GetJetDropsChannel() <-chan *types.JetDrop
}

Transformer represents a transformation raw data from the Platform to conan type

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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