statedb

package
v0.3.14 Latest Latest
Warning

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

Go to latest
Published: Nov 22, 2026 License: MIT Imports: 8 Imported by: 0 modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package statedb 在本地 SQLite 中保存公开 API 的续接节点

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Store

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

Store 读写续接状态库

func Open

func Open(path string, log func(level, message string, attrs ...any)) (*Store, error)

Open 打开或创建续接状态库,按保存顺序读出全部节点的 ID 与续接起点,读写失败时经 log 记录

func (*Store) Close

func (s *Store) Close() error

Close 关闭续接状态库

func (*Store) Index added in v0.3.11

func (s *Store) Index() []api.StateNode

Index 返回打开时读出的节点 ID 与续接起点并释放这份副本

func (*Store) Read added in v0.3.11

func (s *Store) Read(id string) ([]byte, bool)

Read 读出节点正文,节点不存在或读取失败时返回 false

func (*Store) Reclaim added in v0.3.11

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

Reclaim 把空闲页交还文件系统

func (*Store) Save

func (s *Store) Save(saved []api.SavedState, removed []string) error

Save 在一个事务中写入节点并删除已移除的节点,已有节点保留原保存顺序

Jump to

Keyboard shortcuts

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