Documentation ¶
Index ¶
- Variables
- type Account
- type CacheDuration
- type Column
- type CreateVaultParams
- type DBManager
- func (dbm *DBManager) Close()
- func (dbm *DBManager) Export(ctx context.Context, exportPath string) ([]string, error)
- func (dbm *DBManager) NewDB(ctx context.Context) error
- func (dbm *DBManager) Replay(ctx context.Context, tx *pgrepl.Tx) error
- func (dbm *DBManager) UploadAll(ctx context.Context) error
- func (dbm *DBManager) UploadAt(ctx context.Context, exportPath string) error
- type EventInfo
- type ListVaultEventsParams
- type ListVaultsParams
- type Replicator
- type RetrieveEventParams
- type Retriever
- type TableSchema
- type Timestamp
- type Vault
- type VaultsProvider
- type VaultsStreamer
- type VaultsUploader
- type WriteVaultEventParams
Constants ¶
This section is empty.
Variables ¶
var ErrNotFoundInCache = errors.New("not found in cache")
ErrNotFoundInCache is an error when file is not found in cache.
Functions ¶
This section is empty.
Types ¶
type Account ¶
type Account struct {
// contains filtered or unexported fields
}
Account represents an account.
func NewAccount ¶
NewAccount creates a new account.
type CacheDuration ¶
type CacheDuration uint32
CacheDuration how long data stays in cache in minutes.
type CreateVaultParams ¶
type CreateVaultParams struct { Vault Vault Account *Account CacheDuration CacheDuration }
CreateVaultParams ...
type DBManager ¶
type DBManager struct {
// contains filtered or unexported fields
}
DBManager manages a duckdb database.
func NewDBManager ¶
func NewDBManager( dbDir string, schemas []TableSchema, windowInterval time.Duration, uploader *VaultsUploader, ) *DBManager
NewDBManager creates a new DBManager.
func (*DBManager) Replay ¶
Replay replays a WAL record onto the current db. If the window has passed, it replaces the current db with a new one. The current db is exported and uploaded before new db is ready to be used.
type EventInfo ¶
type EventInfo struct { CID string `json:"cid"` Timestamp int64 `json:"timestamp"` IsArchived bool `json:"is_archived"` CacheExpiry string `json:"cache_expiry"` }
EventInfo represents information about a deal.
type ListVaultEventsParams ¶
type ListVaultEventsParams struct { Vault Vault Limit uint32 Offset uint32 Before Timestamp After Timestamp }
ListVaultEventsParams ...
type Replicator ¶
type Replicator interface { StartReplication(ctx context.Context) (chan *pgrepl.Tx, []string, error) Commit(ctx context.Context, lsn pglogrepl.LSN) error Shutdown() }
Replicator replicates Postgres txs into a channel.
type RetrieveEventParams ¶ added in v0.0.8
type RetrieveEventParams struct { Timeout int64 CID cid.Cid }
RetrieveEventParams ...
type Retriever ¶ added in v0.0.8
type Retriever struct {
// contains filtered or unexported fields
}
Retriever is responsible for retrieving file from the network.
func NewRetriever ¶ added in v0.0.8
func NewRetriever(provider VaultsProvider, timeout int64) *Retriever
NewRetriever creates a new Retriever.
type TableSchema ¶ added in v0.0.12
TableSchema represents a table and its schema.
type Timestamp ¶
type Timestamp struct {
// contains filtered or unexported fields
}
Timestamp represents a time a file was uploaded.
func ParseTimestamp ¶
ParseTimestamp parses a string and returns a time.Time object as UTC. It accepts 3 kinds of formats: - Integers: that will be parsed as seconds - Date Only format (e.g. 2006-01-02) - RFC3339 (e.g. 2006-01-02T15:04:05Z07:00).
type VaultsProvider ¶ added in v0.0.7
type VaultsProvider interface { CreateVault(context.Context, CreateVaultParams) error ListVaults(context.Context, ListVaultsParams) ([]Vault, error) ListVaultEvents(context.Context, ListVaultEventsParams) ([]EventInfo, error) WriteVaultEvent(context.Context, WriteVaultEventParams) error RetrieveEvent(context.Context, RetrieveEventParams, io.Writer) (string, error) }
VaultsProvider defines Vaults API.
type VaultsStreamer ¶ added in v0.0.7
type VaultsStreamer struct {
// contains filtered or unexported fields
}
VaultsStreamer contains logic of streaming Postgres changes to Vaults Provider.
func NewVaultsStreamer ¶ added in v0.0.7
func NewVaultsStreamer(ns string, r Replicator, dbm *DBManager) *VaultsStreamer
NewVaultsStreamer creates new streamer.
type VaultsUploader ¶ added in v0.0.7
type VaultsUploader struct {
// contains filtered or unexported fields
}
VaultsUploader contains logic of uploading Parquet files to Vaults Provider.
func NewVaultsUploader ¶ added in v0.0.7
func NewVaultsUploader( ns string, rel string, bp VaultsProvider, pk *ecdsa.PrivateKey, ) *VaultsUploader
NewVaultsUploader creates new uploader.