Documentation
¶
Overview ¶
Package sqlite supplies explicitly opened native persistence. Importing it does not create files, open a database, or start a service.
Index ¶
- Constants
- Variables
- func MigrationStatus(ctx context.Context, path, name string) (bool, error)
- type CatalogEntry
- type CatalogPage
- type CatalogQuery
- type Chat
- type DB
- func (db *DB) Backup(ctx context.Context, path string) (err error)
- func (db *DB) Chat(namespace string) *Chat
- func (db *DB) Document(namespace, key string) *Document
- func (db *DB) Foreign(profile string) *Foreign
- func (db *DB) Memory(namespace string) *Memory
- func (db *DB) Migrate(ctx context.Context, name string, sources []MigrationSource, ...) error
- func (db *DB) Migrated(ctx context.Context, name string) (bool, error)
- func (db *DB) RestoreSessions(ctx context.Context, path, namespace string) (int, error)
- func (db *DB) Sessions(namespace string) *Sessions
- type Document
- type Foreign
- func (c *Foreign) Begin(ctx context.Context, peer string) (int64, error)
- func (c *Foreign) Forget(ctx context.Context, peer string) error
- func (c *Foreign) List(ctx context.Context, peer string) ([]ForeignSession, error)
- func (c *Foreign) Put(ctx context.Context, ticket int64, s ForeignSession) error
- type ForeignSession
- type Memory
- func (store *Memory) Append(ctx context.Context, item memory.Item) (string, error)
- func (store *Memory) Delete(ctx context.Context, id string) error
- func (store *Memory) Get(ctx context.Context, id string) (memory.Item, error)
- func (store *Memory) Query(ctx context.Context, filter memory.Filter) ([]memory.Item, error)
- func (store *Memory) Transact(ctx context.Context, fn func(memory.Store) error) error
- type MigrationSource
- type PreviewMessage
- type Sessions
- func (r *Sessions) Catalog(ctx context.Context, q CatalogQuery) (CatalogPage, error)
- func (r *Sessions) Create(ctx context.Context, options harness.SessionCreateOptions) (*harness.Session, error)
- func (r *Sessions) Delete(ctx context.Context, metadata harness.SessionMetadata) error
- func (r *Sessions) Fork(ctx context.Context, source harness.SessionMetadata, ...) (*harness.Session, error)
- func (r *Sessions) Import(ctx context.Context, content []byte) (harness.SessionMetadata, error)
- func (r *Sessions) List(ctx context.Context, options harness.SessionListOptions) ([]harness.SessionMetadata, error)
- func (r *Sessions) ListInfo(ctx context.Context, cwd string, update session.SessionListUpdateFunc) ([]session.SessionInfo, error)
- func (r *Sessions) Open(ctx context.Context, metadata harness.SessionMetadata) (*harness.Session, error)
- func (r *Sessions) OpenPath(ctx context.Context, reference string) (*harness.Session, error)
Constants ¶
const ForeignPreviewBytes = 32 << 10
const ForeignRetention = 7 * 24 * time.Hour
Variables ¶
var ErrForeignSuperseded = errors.New("foreign refresh superseded or revoked")
var ErrImportConflict = errors.New("conflicting session import")
Import upgrades legacy Pi trees without modifying their source files. ErrImportConflict reports a journal whose session ID is stored with other content.
Functions ¶
Types ¶
type CatalogEntry ¶
type CatalogPage ¶
type CatalogPage struct {
Sessions []CatalogEntry `json:"sessions"`
Next string `json:"next,omitempty"`
}
type CatalogQuery ¶
type DB ¶
DB is an open database. Writes made through the embedded *sql.DB bypass the cross-process writer queue; this package routes every write through begin.
func (*DB) Migrate ¶
func (db *DB) Migrate(ctx context.Context, name string, sources []MigrationSource, verify ...func() error) error
Migrate checkpoints each source independently, then verifies the complete inventory before publishing cutover. Retrying never overwrites native writes.
func (*DB) RestoreSessions ¶
RestoreSessions recovers missing conversations without rolling back authority, credentials, operation receipts, or chat delivery state. Conflicts fail closed; rerunning after interruption accepts only identical already-restored journals.
type Foreign ¶
type Foreign struct {
// contains filtered or unexported fields
}
func (*Foreign) Begin ¶
Begin allocates an ordering token before network I/O. Forget advances the floor, so an in-flight response can never resurrect purged content.
type ForeignSession ¶
type ForeignSession struct {
Peer, Namespace, ID, Instance, Name, CWD string
RefreshedAt time.Time
Messages []PreviewMessage
}
func (*ForeignSession) AddMessage ¶
func (s *ForeignSession) AddMessage(raw json.RawMessage)
AddMessage retains only visible, completed conversation text. Callers must not feed streaming deltas, which would duplicate messages in offline previews.
type Memory ¶
type Memory struct {
// contains filtered or unexported fields
}
type MigrationSource ¶
type MigrationSource struct {
Path, Namespace, Key, Kind string
}
MigrationSource names an explicit offline source. Originals are never changed. The caller must quiesce legacy writers and hold its native-root migration lock.
type PreviewMessage ¶
type Sessions ¶
type Sessions struct {
// contains filtered or unexported fields
}
func (*Sessions) Catalog ¶
func (r *Sessions) Catalog(ctx context.Context, q CatalogQuery) (CatalogPage, error)
Catalog pages on immutable creation order so streaming cannot move a row across page boundaries. Views can sort received summaries by live activity.
func (*Sessions) Fork ¶
func (r *Sessions) Fork(ctx context.Context, source harness.SessionMetadata, options harness.SessionForkOptions) (*harness.Session, error)
func (*Sessions) List ¶
func (r *Sessions) List(ctx context.Context, options harness.SessionListOptions) ([]harness.SessionMetadata, error)
func (*Sessions) ListInfo ¶
func (r *Sessions) ListInfo(ctx context.Context, cwd string, update session.SessionListUpdateFunc) ([]session.SessionInfo, error)