syncer

package
v0.0.0-...-4eea697 Latest Latest
Warning

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

Go to latest
Published: Sep 26, 2023 License: Apache-2.0 Imports: 20 Imported by: 0

Documentation

Index

Constants

View Source
const (
	BlockNotFoundTimeout = time.Second * 15
	BlockGetErrorTimeout = time.Second * 30

	RolePatient uint8 = 0
	RoleDoctor  uint8 = 1
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Config

type Config struct {
	Endpoint   string
	StartBlock uint64
	Contracts  []struct {
		Name    string
		Address string
	}
}

type Syncer

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

func New

func New(repo SyncerRepo, chunkRepo TreeIndexChunkRepositpry, ethClient *ethclient.Client, cfg Config) *Syncer

func (*Syncer) Start

func (s *Syncer) Start(ctx context.Context)

type SyncerRepo

type SyncerRepo interface {
	SyncLastBlockGet(ctx context.Context) (uint64, error)
	SyncLastBlockSet(ctx context.Context, lastSyncedBlock uint64) error

	StatPatientsCountIncrement(ctx context.Context, timestamp time.Time) error
	StatDocumentsCountIncrement(ctx context.Context, timestamp time.Time) error
}

type TreeIndexChunkRepositpry

type TreeIndexChunkRepositpry interface {
	AddNewIndexObject(ctx context.Context, chunk models.IndexChunk) error
	GetAllIndexObjects(ctx context.Context) ([]models.IndexChunk, error)
}

Jump to

Keyboard shortcuts

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