upload

package
v1.13.0 Latest Latest
Warning

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

Go to latest
Published: Feb 11, 2026 License: Apache-2.0 Imports: 11 Imported by: 0

Documentation

Overview

Package upload handles uploading local changes to the backend.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Emitter

type Emitter func(Event)

Emitter is a function that handlers use to emit events.

type Event

type Event interface {
	// contains filtered or unexported methods
}

Event is the interface for all upload events. Handlers can define their own event types that implement this interface.

type Handler

type Handler interface {
	Handle(ctx context.Context, entry *db.CrudEntry, emit Emitter) error
}

Handler processes CRUD entries for a specific table.

type RecoveredEvent

type RecoveredEvent struct {
	StalledFor time.Duration
}

RecoveredEvent is emitted when upload recovers from a stalled state.

type StalledEvent

type StalledEvent struct {
	Error      error
	Table      sqlite.Table
	RowID      string
	StalledFor time.Duration
}

StalledEvent is emitted when upload is blocked on a failing entry.

type SyncingEvent

type SyncingEvent struct {
	ProcessedCount int
}

SyncingEvent is emitted when entries are being processed.

type TokenRefresher

type TokenRefresher interface {
	GetAccessToken(ctx context.Context) (string, error)
}

TokenRefresher provides access tokens for authentication.

type Uploader

type Uploader interface {
	Run(ctx context.Context) error
	Events() <-chan Event
}

Uploader watches the CRUD queue and uploads changes to the backend.

func New

func New(
	database sqlite.DB,
	client psapi.Client,
	tokenRefresher TokenRefresher,
	conversations api.Conversations,
	messages api.Messages,
	scope log.Scope,
) Uploader

New creates a new uploader.

Jump to

Keyboard shortcuts

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