加入 Gitee
与超过 1200万 开发者一起发现、参与优秀开源项目,私有仓库也完全免费 :)
免费加入
文件
克隆/下载
keyvalue_log.go 1.10 KB
一键复制 编辑 原始数据 按行查看 历史
package influxdb
import (
"context"
"time"
)
// KeyValueLog is a generic type logs key-value pairs. This interface is intended to be used to construct other
// higher-level log-like resources such as an oplog or audit log.
//
// The idea is to create a log who values can be accessed at the key k:
// k -> [(v0,t0) (v1,t1) ... (vn,tn)]
//
// Logs may be retrieved in ascending or descending time order and support limits and offsets.
type KeyValueLog interface {
// AddLogEntry adds an entry (v,t) to the log defined for the key k.
AddLogEntry(ctx context.Context, k []byte, v []byte, t time.Time) error
// ForEachLogEntry iterates through all the log entries at key k and applies the function fn for each record.
ForEachLogEntry(ctx context.Context, k []byte, opts FindOptions, fn func(v []byte, t time.Time) error) error
// FirstLogEntry is used to retrieve the first entry in the log at key k.
FirstLogEntry(ctx context.Context, k []byte) ([]byte, time.Time, error)
// LastLogEntry is used to retrieve the last entry in the log at key k.
LastLogEntry(ctx context.Context, k []byte) ([]byte, time.Time, error)
}
马建仓 AI 助手
尝试更多
代码解读
代码找茬
代码优化