본문으로 건너뛰기

저장, revision, lineage

구현됨

구현 저장소: BackwardLabs/daejang-db @ 26904fb

PostgreSQL DDL, migration, 공개 Go client가 구현되어 있다. revision, lineage, outcome과 실패 상태를 덮어쓰지 않고 보존한다.

저장 영역

영역내용
Artifactcontent-addressed artifact와 reference·pin metadata
JITrun, command queue, candidate outcome, inclusion revision, execution cache, outbox
Subject evidenceevidence fragment, observation, disposition
Chain·source evidenceevidence bundle과 lineage, revision
Ledgerassertion, hypothesis, interpreted event, event revision
Postingleg, posting, valuation, reconciliation
Lotlot run, allocation, basis, current pointer, outbox

공개 Go package

Package범위
artifactstorecontent-addressed artifact와 pinning
evidencestorechain·source evidence bundle, lineage, revision
jitstoreJIT run, command queue, candidate outcome, execution cache
ledgerstoreassertion, hypothesis, interpreted event, posting, valuation
lotstorelot run, allocation, basis, current pointer

저장과 계산은 다르다

저장은 계산이 아니다

ledgerstorelotstore가 있다는 사실은 Event 엔진이나 lot 계산 엔진이 있다는 뜻이 아니다.

DB는 경제적 Event, Posting, valuation, 취득가액을 저장할 수 있다. 그중 어느 것도 계산하지 않는다. 그 값을 만들어낼 runtime은 계획이다. Event, Posting, Valuation세무 원가와 리포트를 참고하라.

이 구분은 ledger와 lot package를 설명할 때도 그대로 적용한다.

Content addressing

artifact는 내용의 SHA-256으로 주소를 갖는다. 공개 execution artifact는 provider 실행 증거만 담으며 subjectId, account ID, ownership window를 포함해서는 안 된다. 이 규칙이 있어야 같은 execution artifact를 여러 사용자의 account가 공유하면서도 그 관계를 노출하지 않는다. 보안과 개인정보를 참고하라.

Revision과 lineage

revision은 결과가 바뀐 이유를 남긴다.

  • Inclusion revision은 이전 inclusion을 대체하지 않고 reorg 이력을 기록한다.
  • Evidence bundle lineage는 bundle이 무엇을 대체하는지와 그 이유를 연결한다.
  • Outcome 저장은 실패를 포함한 terminal state를 저장하므로, coverage를 낙관적으로 재계산하지 않고 저장된 outcome에서 유도한다.
  • Outbox table은 JIT와 lot 경로에서 dual-write 불일치 없이 신뢰할 수 있는 downstream 전달을 지원한다.

이들이 함께 기술 개요에 서술한 revision integrity 원칙을 뒷받침한다. 입력, 정책, 판단이 바뀌면 이전 결과를 덮어쓰지 않고 변경 원인을 기록한 새 revision을 만든다.

검증

기본 브랜치에서 make check, go test ./..., go vet ./..., go build ./...가 통과한다.

Integration test는 조건부다

PostgreSQL integration test는 환경에 DAEJANG_DB_TEST_POSTGRES_URL 또는 ledger 전용 URL이 있을 때만 실행된다. 위 통과 결과만으로는 live PostgreSQL integration을 확인할 수 없다.

JIT → schema 검증 → PostgreSQL 저장의 재현 가능한 시연은 현재 제약에 필요한 증빙으로 정리했다.