database

package
v0.2.0 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func MigrationFS

func MigrationFS() fs.FS

MigrationFS exposes the canonical SQL migrations without global registration.

Types

type CommaSeparatedList

type CommaSeparatedList []string

CommaSeparatedList allows lists of strings to be stored in a single database column as a comma-separated string, with each string base64-encoded to handle special characters and commas within the strings themselves.

func (*CommaSeparatedList) Scan

func (b *CommaSeparatedList) Scan(src any) error

func (CommaSeparatedList) Value

func (b CommaSeparatedList) Value() (driver.Value, error)

type CreateDebugletParams

type CreateDebugletParams struct {
	Uuid                  uuid.UUID
	StartTime             UTCTime
	Args                  CommaSeparatedList
	Wasm                  []byte
	TransactionID         string
	FloorBw               int64
	CeilBw                int64
	TimeoutMs             int64
	Addresses             CommaSeparatedList
	RequireIcmp           bool
	ListenUdp             bool
	ListenTcp             bool
	ListenScion           bool
	DispatcherIncarnation string
	SessionID             string
}

type CreateTeslaChainParams

type CreateTeslaChainParams struct {
	Generation  int64
	Anchor      []byte
	EpochBase   time.Time
	DelayNs     int64
	ChainLength int64
	CreatedAt   time.Time
}

type DBTX

type DBTX interface {
	ExecContext(context.Context, string, ...interface{}) (sql.Result, error)
	PrepareContext(context.Context, string) (*sql.Stmt, error)
	QueryContext(context.Context, string, ...interface{}) (*sql.Rows, error)
	QueryRowContext(context.Context, string, ...interface{}) *sql.Row
}

type Debuglet

type Debuglet struct {
	ID                    int64
	Uuid                  uuid.UUID
	StartTime             UTCTime
	Args                  CommaSeparatedList
	Wasm                  []byte
	TransactionID         string
	FloorBw               int64
	CeilBw                int64
	TimeoutMs             int64
	Addresses             CommaSeparatedList
	RequireIcmp           bool
	ListenUdp             bool
	ListenTcp             bool
	ListenScion           bool
	StartedAt             UTCTime
	DispatcherIncarnation string
	SessionID             string
}

type DebugletExit

type DebugletExit struct {
	DebugletID            string
	DispatcherIncarnation string
	SessionID             string
	ExitCode              int64
	ErrorMessage          sql.NullString
	RecordedAt            UTCTime
	Attempts              int64
	LastAttemptAt         UTCTime
	LastError             string
	Rejected              bool
}

type DebugletLog

type DebugletLog struct {
	ID         int64
	DebugletID int64
	Timestamp  time.Time
	Output     []byte
}

type GetDebugletIdentityRow

type GetDebugletIdentityRow struct {
	Uuid                  uuid.UUID
	DispatcherIncarnation string
	SessionID             string
	TransactionID         string
	StartTime             UTCTime
	StartedAt             UTCTime
}

type GetOwnedDebugletByUUIDParams

type GetOwnedDebugletByUUIDParams struct {
	Uuid                  uuid.UUID
	DispatcherIncarnation string
	SessionID             string
}

type ListDebugletExitsForBindingParams

type ListDebugletExitsForBindingParams struct {
	DispatcherIncarnation string
	SessionID             string
	Limit                 int64
}

type ListDebugletsParams

type ListDebugletsParams struct {
	Limit  int64
	Offset int64
}

type NoteDebugletExitFailureParams

type NoteDebugletExitFailureParams struct {
	Attempts              int64
	LastAttemptAt         UTCTime
	LastError             string
	Rejected              bool
	DebugletID            string
	DispatcherIncarnation string
	SessionID             string
}

type Queries

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

func New

func New(db DBTX) *Queries

func (*Queries) CountDebugletExits

func (q *Queries) CountDebugletExits(ctx context.Context) (int64, error)

func (*Queries) CreateDebuglet

func (q *Queries) CreateDebuglet(ctx context.Context, arg CreateDebugletParams) error

func (*Queries) CreateTeslaChain

func (q *Queries) CreateTeslaChain(ctx context.Context, arg CreateTeslaChainParams) error

func (*Queries) DeleteDebuglet

func (q *Queries) DeleteDebuglet(ctx context.Context, argUuid uuid.UUID) error

func (*Queries) GetDebugletByUUID

func (q *Queries) GetDebugletByUUID(ctx context.Context, argUuid uuid.UUID) (Debuglet, error)

func (*Queries) GetDebugletExit

func (q *Queries) GetDebugletExit(ctx context.Context, debugletID string) (DebugletExit, error)

func (*Queries) GetDebugletIdentity

func (q *Queries) GetDebugletIdentity(ctx context.Context, argUuid uuid.UUID) (GetDebugletIdentityRow, error)

Identity, original binding and start marker only: inspection never reads the stored WASM blob or arguments.

func (*Queries) GetDebugletStarted

func (q *Queries) GetDebugletStarted(ctx context.Context, argUuid uuid.UUID) (UTCTime, error)

func (*Queries) GetOwnedDebugletByUUID

func (q *Queries) GetOwnedDebugletByUUID(ctx context.Context, arg GetOwnedDebugletByUUIDParams) (Debuglet, error)

func (*Queries) ListDebugletExits

func (q *Queries) ListDebugletExits(ctx context.Context, limit int64) ([]DebugletExit, error)

func (*Queries) ListDebugletExitsForBinding

func (q *Queries) ListDebugletExitsForBinding(ctx context.Context, arg ListDebugletExitsForBindingParams) ([]DebugletExit, error)

Only a session's own deliverable results, so results no session can deliver cannot crowd out the ones that can be.

func (*Queries) ListDebuglets

func (q *Queries) ListDebuglets(ctx context.Context, arg ListDebugletsParams) ([]Debuglet, error)

func (*Queries) ListTeslaChains

func (q *Queries) ListTeslaChains(ctx context.Context) ([]TeslaChain, error)

func (*Queries) NextTeslaChainGeneration

func (q *Queries) NextTeslaChainGeneration(ctx context.Context) (int64, error)

func (*Queries) NoteDebugletExitFailure

func (q *Queries) NoteDebugletExitFailure(ctx context.Context, arg NoteDebugletExitFailureParams) (int64, error)

func (*Queries) RecordDebugletExit

func (q *Queries) RecordDebugletExit(ctx context.Context, arg RecordDebugletExitParams) error

The first write wins: a duplicate report never rewrites the chosen result.

func (*Queries) ReleaseDebugletExit

func (q *Queries) ReleaseDebugletExit(ctx context.Context, arg ReleaseDebugletExitParams) (int64, error)

func (*Queries) UpdateDebugletStarted

func (q *Queries) UpdateDebugletStarted(ctx context.Context, arg UpdateDebugletStartedParams) (Debuglet, error)

func (*Queries) WithTx

func (q *Queries) WithTx(tx *sql.Tx) *Queries

type RecordDebugletExitParams

type RecordDebugletExitParams struct {
	DebugletID            string
	DispatcherIncarnation string
	SessionID             string
	ExitCode              int64
	ErrorMessage          sql.NullString
	RecordedAt            UTCTime
}

type ReleaseDebugletExitParams

type ReleaseDebugletExitParams struct {
	DebugletID            string
	DispatcherIncarnation string
	SessionID             string
}

type TeslaChain

type TeslaChain struct {
	Generation  int64
	Anchor      []byte
	EpochBase   time.Time
	DelayNs     int64
	ChainLength int64
	CreatedAt   time.Time
}

type UTCTime

type UTCTime struct {
	time.Time
}

UTCTime is a wrapper around time.Time that ensures the time is always stored and retrieved in UTC.

func NewUTCTime

func NewUTCTime(t time.Time) UTCTime

func (*UTCTime) Scan

func (t *UTCTime) Scan(src any) error

func (UTCTime) Value

func (t UTCTime) Value() (driver.Value, error)

type UpdateDebugletStartedParams

type UpdateDebugletStartedParams struct {
	StartedAt UTCTime
	Uuid      uuid.UUID
}

Jump to

Keyboard shortcuts

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