Commit Graph
6 Commits
Author SHA1 Message Date
pingqiuandClaude Opus 4.6 ec49e5a28f feat(uds): add Store opcode, AppendRawNeedle, and SRA transport client
Volume replication groundwork (Phase 6 hardening plan):

- UDS handler: Add Store opcode (0x02) with opcode-based dispatch,
  StoreRequest/StoreResponse wire types, and size validation
- storage/store.go: AppendRawNeedle() for accepting pre-serialized
  needle bytes from RDMA replication path
- storage/needle: Return raw bytes from needle Append() to enable
  forwarding exact .dat bytes without re-serialization
- storage/sra_transport.go: UDS client for outbound RDMA replication
  (connects to /tmp/sra-transport.sock, nil-safe fallback to HTTP)
- command/volume.go: Wire -uds.transport flag
- Integration test for Store opcode round-trip
- Golden wire tests for Store request/response encoding

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-12 19:35:08 -08:00
pingqiuandClaude Opus 4.6 a07f965e99 test(uds): add cross-language wire contract golden tests
Add golden byte fixtures for LocateRequest and LocateResponse that must
match the Rust sra-volume side exactly. Also add needle endianness
contract test documenting that SeaweedFS uses big-endian for all
multi-byte needle fields.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 15:54:35 -08:00
pingqiuandClaude Opus 4.6 39688c8a40 fix(uds): align request wire format with sra-common LocateRequest
Go server was parsing fid at bytes 0-15 (Go format), but Rust
uds_client sends opcode(1)+pad(3)+request_id(4)+fid(16) per
sra-common::uds_proto::LocateRequest repr(C).

Now Go parses: opcode at byte 0, request_id at bytes 4-7, fid at
bytes 8-23. Matches the Rust wire format exactly.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 15:04:39 -08:00
pingqiuandClaude Opus 4.6 cc634da5bd feat(uds): include .dat file path in locate response
Add DatPathLen (2 bytes at offset 24) + variable-length DatPath after
the 32-byte header. Solves the filename mismatch where sra-volume
assumed {vol}.dat but SeaweedFS uses {collection}_{vol}.dat.

Backward compatible: old clients that only read 32 bytes still work
(DatPathLen is in the formerly-reserved region, and the trailing
path bytes are simply ignored by old readers).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 14:50:29 -08:00
pingqiuandClaude Opus 4.6 f20c05ea0a fix(uds): guard against nil VolumeServer in handleLocate
Prevent nil pointer dereference when VolumeServer is nil by adding
an early return with UdsStatusError before accessing vs.store.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
2026-02-08 10:58:36 -08:00
pingqiuandClaude Opus 4.5 e064c86d12 feat(volume): add UDS handler for RDMA sidecar integration
Add Unix Domain Socket (UDS) handler to Volume server for RDMA sidecar
(sra-volume) to query needle locations without HTTP overhead.

Protocol (per UDS_LOCATE_API_SPEC.md):
- Request: 24 bytes (fid[16] + version[4] + flags[4])
- Response: 32 bytes (status[1] + pad[3] + volume_id[4] + offset[8] + length[8] + reserved[8])

Changes:
- weed/server/volume_server_uds.go: UDS server implementation
  - Parses fid via needle.ParseFileIdFromString()
  - Looks up volume via store.GetVolume()
  - Queries needle offset via Volume.GetNeedle()
  - Returns (volumeId, offset, length) or NotFound/Error

- weed/storage/volume.go: Added GetNeedle() method
  - Exposes nm.Get() for UDS handler

- weed/command/volume.go: Added -uds.listen flag
  - Example: weed volume -dir=/data -uds.listen=/tmp/sra-volume.sock
  - UDS server starts/stops with volume lifecycle

- weed/server/volume_server_uds_test.go: 8 tests
  - Protocol size verification
  - Request/response serialization
  - Connection and fid parsing tests

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
2026-02-08 01:11:40 -08:00