store

package
v0.2.0 Latest Latest
Warning

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

Go to latest
Published: Nov 7, 2026 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

View Source
const MaxAttempts = 5

Variables

This section is empty.

Functions

func BackupStopped added in v0.2.0

func BackupStopped(ctx context.Context, path, destination string) (func(), error)

BackupStopped retains an exclusive lock until the caller completes an update.

func Restore added in v0.2.0

func Restore(ctx context.Context, source, destination string, replace bool) (string, error)

Restore keeps an automatic rollback copy before replacing an existing database. All Ranjit processes hold a shared lock; restoration requires exclusive access.

Types

type Checkpoint

type Checkpoint struct {
	Store *Store
	Job   ranjit.Job
	Now   func() time.Time
}

func (Checkpoint) Load

func (c Checkpoint) Load(ctx context.Context, endpoint string) ([]byte, error)

func (Checkpoint) Save

func (c Checkpoint) Save(ctx context.Context, endpoint string, body []byte) error
type Search struct {
	Customer, Account, Query, From, Through, Cursor string
	Limit                                           int
}

type Store

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

func Open

func Open(ctx context.Context, path string) (*Store, error)

func (*Store) Accounts

func (s *Store) Accounts(ctx context.Context, id, cursor string, limit int, now time.Time) (ranjit.Page[ranjit.Account], error)

func (*Store) Backup added in v0.2.0

func (s *Store) Backup(ctx context.Context, destination string) error

Backup creates a consistent standalone SQLite snapshot without stopping readers. An existing destination is never replaced, even if another process creates it.

func (*Store) Claim

func (s *Store) Claim(ctx context.Context, now time.Time, lease time.Duration) (ranjit.Job, error)

func (*Store) ClaimSelected

func (s *Store) ClaimSelected(ctx context.Context, now time.Time, lease time.Duration, selected map[string]bool) (ranjit.Job, error)

func (*Store) Close

func (s *Store) Close() error

func (*Store) Complete

func (s *Store) Complete(ctx context.Context, j ranjit.Job, batch provider.Snapshot, now time.Time) error

func (*Store) ConfiguredConnections

func (s *Store) ConfiguredConnections(ctx context.Context, institutions []string) (map[string]bool, error)

ConfiguredConnections excludes profiles absent from this process. A separate CLI process may add a profile while the server still has its old configuration.

func (*Store) Connection

func (s *Store) Connection(ctx context.Context, id string, now time.Time) (ranjit.Connection, error)

func (*Store) Connections

func (s *Store) Connections(ctx context.Context, customer, cursor string, limit int, now time.Time) (ranjit.Page[ranjit.Connection], error)

func (*Store) CreateAuthorizedConnection

func (s *Store) CreateAuthorizedConnection(ctx context.Context, c ranjit.Connection) error

CreateAuthorizedConnection persists the operator's local grant and first job atomically.

func (*Store) CreateConnection

func (s *Store) CreateConnection(ctx context.Context, c ranjit.Connection, tokenHash string, deadline time.Time) error

func (*Store) Decide

func (s *Store) Decide(ctx context.Context, hash string, approve bool, now time.Time) (ranjit.Connection, error)

Decide consumes the authorization token and queues the first sync in the same transaction.

func (*Store) Enqueue

func (s *Store) Enqueue(ctx context.Context, id string, now time.Time) (ranjit.Job, error)

func (*Store) Expire

func (s *Store) Expire(ctx context.Context, now time.Time) error

func (*Store) Fail

func (s *Store) Fail(ctx context.Context, j ranjit.Job, code string, now time.Time) error

func (*Store) FailAfter

func (s *Store) FailAfter(ctx context.Context, j ranjit.Job, code string, now time.Time, retryAfter time.Duration) error

func (*Store) Import

func (s *Store) Import(ctx context.Context, customer, account string, input statement.Statement, now time.Time) (ranjit.ImportResult, error)

func (*Store) Job

func (s *Store) Job(ctx context.Context, id string) (ranjit.Job, error)

func (*Store) Pause added in v0.2.0

func (s *Store) Pause(ctx context.Context, id string, now time.Time) error

func (*Store) PendingConsent

func (s *Store) PendingConsent(ctx context.Context, hash string, now time.Time) (ranjit.Connection, error)

func (*Store) Ping

func (s *Store) Ping(ctx context.Context) error

func (*Store) PreviewImport added in v0.2.0

func (s *Store) PreviewImport(ctx context.Context, customer, account string, input statement.Statement, now time.Time) (ranjit.ImportResult, error)

func (*Store) Renew added in v0.2.0

func (s *Store) Renew(ctx context.Context, id, binding string, deadline, now time.Time) (ranjit.Connection, error)

func (*Store) Revoke

func (s *Store) Revoke(ctx context.Context, id string, now time.Time) error

Revoke removes normalized data before returning. The connection record is retained.

func (*Store) Schedule

func (s *Store) Schedule(ctx context.Context, now time.Time, interval time.Duration) error

func (*Store) ScheduleSelected

func (s *Store) ScheduleSelected(ctx context.Context, now time.Time, interval time.Duration, selected map[string]bool) error

func (*Store) SearchTransactions added in v0.2.0

func (s *Store) SearchTransactions(ctx context.Context, f Search, now time.Time) (ranjit.Page[ranjit.Transaction], error)

func (*Store) Status

func (s *Store) Status(ctx context.Context, id string, now time.Time) (ranjit.ConnectionStatus, error)

func (*Store) Transactions

func (s *Store) Transactions(ctx context.Context, accountID, cursor string, limit int, now time.Time) (ranjit.Page[ranjit.Transaction], error)

func (*Store) Yield

func (s *Store) Yield(ctx context.Context, j ranjit.Job, now time.Time) error

Yield continues a healthy, long sync without spending a failure attempt.

Jump to

Keyboard shortcuts

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