Commit Graph

2 Commits

Author SHA1 Message Date
Tutus Development c21789557c Add BlockStorage and StateStorage to local adapter with tests
Implement full local storage adapter with three interfaces:
- Provider: Basic object storage (Put, Get, Delete, Exists, List, Head)
- BlockStorage: Block-indexed storage (PutBlock, GetBlock, GetBlockRange)
- StateStorage: State snapshot storage (PutState, GetState, GetLatestState)

Implementation details:
- Content-addressed storage using SHA256 for object IDs
- Directory sharding for filesystem performance:
  - Objects: first 2 chars of hash (e.g., objects/91/91f0...)
  - Blocks: every 10,000 (e.g., blocks/0001/12345.block)
  - States: every 10,000 (e.g., states/0001/12345.state)
- Metadata JSON sidecar files with content type and attributes
- Thread-safe with sync.RWMutex
- Size quota enforcement across all directories

Test coverage (30 tests):
- Provider interface: Put/Get, Delete, Exists, Head, List, quota
- BlockStorage: PutGetBlock, GetBlockRange, GetLatestBlockIndex
- StateStorage: PutGetState, GetLatestState, quota enforcement
- Path helpers and interface compliance verification

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2025-12-21 06:58:20 -05:00
Tutus Development cf0c52980f Add Tutus Storage Interface for sovereign data storage
Create pluggable storage abstraction for government blockchain deployments:

pkg/storage/
- storage.go: Core Provider, BlockStorage, StateStorage interfaces
- config.go: Configuration for NeoFS, Local, S3 backends
- errors.go: Common storage error types
- doc.go: Package documentation with compliance guidance

pkg/storage/neofs/
- Adapter implementing Provider interface (placeholder for NeoFS SDK)

pkg/storage/local/
- Full implementation for local filesystem storage
- Content-addressed storage with SHA256 IDs
- Metadata JSON sidecar files

docs/storage.md: Comprehensive documentation covering:
- Data sovereignty compliance (GDPR, China CSL, etc.)
- Provider configuration examples
- Interface reference
- Security considerations

This enables nations to choose compliant storage backends while
maintaining a consistent API for block and state storage.
2025-12-21 06:38:32 -05:00