MCPcopy Create free account
hub / github.com/MemTensor/MemOS / insertChunk

Method insertChunk

apps/memos-local-openclaw/src/storage/sqlite.ts:1175–1198  ·  view source on GitHub ↗
(chunk: Chunk)

Source from the content-addressed store, hash-verified

1173 // ─── Write ───
1174
1175 insertChunk(chunk: Chunk): void {
1176 const stmt = this.db.prepare(`
1177 INSERT OR REPLACE INTO chunks (id, session_key, turn_id, seq, role, content, kind, summary, task_id, content_hash, owner, dedup_status, dedup_target, dedup_reason, created_at, updated_at)
1178 VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?, ?)
1179 `);
1180 stmt.run(
1181 chunk.id,
1182 chunk.sessionKey,
1183 chunk.turnId,
1184 chunk.seq,
1185 chunk.role,
1186 chunk.content,
1187 chunk.kind,
1188 chunk.summary,
1189 chunk.taskId,
1190 contentHash(chunk.content),
1191 chunk.owner ?? "agent:main",
1192 chunk.dedupStatus ?? "active",
1193 chunk.dedupTarget ?? null,
1194 chunk.dedupReason ?? null,
1195 chunk.createdAt,
1196 chunk.updatedAt,
1197 );
1198 }
1199
1200 markDedupStatus(chunkId: string, status: "duplicate" | "merged", targetChunkId: string | null, reason: string): void {
1201 this.db.prepare(

Callers 15

registerFunction · 0.95
setupTaskSharingHarnessFunction · 0.95
storeChunkMethod · 0.45
runMigrationMethod · 0.45
importAgentMethod · 0.45
seedChunksFunction · 0.45
insertTestChunkFunction · 0.45
insertChunkFunction · 0.45
storage.test.tsFile · 0.45

Calls 3

prepareMethod · 0.80
contentHashFunction · 0.70
runMethod · 0.65

Tested by 5

setupTaskSharingHarnessFunction · 0.76
seedChunksFunction · 0.36
insertTestChunkFunction · 0.36
insertChunkFunction · 0.36