Skip to content

[CAS-001] Content store core — src/content.js #272

@flyingrobots

Description

@flyingrobots

CAS-001: Content store core

Parent: #271 (M13 VESSEL)

Deliverable

New module src/content.js with:

  • writeContent(plumbing, graph, nodeId, buffer, { mime, encoding }) — writes blob via git hash-object -w --stdin, sets _content.* properties on node via patch
  • readContent(plumbing, graph, nodeId) — reads _content.sha property, retrieves blob via git cat-file blob <sha>, verifies SHA integrity on read
  • getContentMeta(graph, nodeId) — returns { sha, mime, size, encoding } from node properties
  • hasContent(graph, nodeId) — boolean check for _content.sha property
  • deleteContent(graph, nodeId) — removes _content.* properties via patch

Design

  • Property convention: _content.sha, _content.mime, _content.size, _content.encoding
  • SHA integrity: verify blob SHA matches stored _content.sha on read
  • Fails if node doesn't exist in graph
  • Overwriting content updates properties; old blob stays in git object store
  • Requires plumbing instance — graph.js refactored to expose it from loadGraph()

Exports

Added to src/index.js public API.

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions