28 lines
1.2 KiB
Go
28 lines
1.2 KiB
Go
// 织忆 MemoryWeave — LanceDB 接口定义
|
||
// 所有存储后端实现此接口,Go → Rust IPC 由 internal/consolidate 负责
|
||
|
||
package storage
|
||
|
||
import "github.com/xiaoxue/memoryweave/internal/models"
|
||
|
||
// LanceDB 存储后端统一接口
|
||
// 实现者: SQLiteClient (生产), MemLanceClient (开发/降级)
|
||
// 未来: Rust lancedb crate 通过 Unix Socket 提供 LanceDB 原生后端
|
||
type LanceDB interface {
|
||
InsertEpisode(agentID, namespace, content, category string) (string, error)
|
||
GetTopByQuality(agentID string, limit int) ([]models.MemoryRecord, error)
|
||
Stats() (map[string]interface{}, error)
|
||
SoftDelete(id, reason string) error
|
||
GetVersionHistory(id string) ([]map[string]interface{}, error)
|
||
GetCandidatesForForgetting() ([]map[string]interface{}, error)
|
||
Backup(path string) error
|
||
GetAuditLog(limit int) ([]map[string]interface{}, error)
|
||
IncrementUseful(id string)
|
||
IncrementNotUseful(id string)
|
||
UpdateMemoryContent(id, newContent, source string) error
|
||
InsertMemory(m models.MemoryRecord) error
|
||
Search(table string, vector []float32, topK int, namespaceFilter string) ([]models.MemoryRecord, error)
|
||
Insert(table string, record any) error
|
||
Update(table, id string, fields map[string]any) error
|
||
}
|