mirror of
https://github.com/hanzoai/replicate.git
synced 2026-10-30 18:23:20 +00:00
- All source files, configs, docs, CI renamed - Binary: replicate (not litestream) - Config: replicate.yml (litestream.yml as fallback) - Env: REPLICATE_* (LITESTREAM_* as fallback) - Socket: /var/run/replicate.sock - Image: ghcr.io/hanzoai/replicate - Module: github.com/hanzoai/replicate - Package name: replicate (Go), replicate-vfs (npm/pip/gem) - VFS: registered as "replicate", pragmas replicate_* - C exports: ReplicateVFSRegister, GoReplicate* - Windows service: Replicate - Systemd unit: replicate.service - Upstream attribution preserved (README, upgrade test scripts)
2.0 KiB
2.0 KiB
Validate a ReplicaClient implementation in Replicate. This command helps ensure a replica client correctly implements the interface and handles edge cases.
First, identify what needs validation:
- Which replica client implementation?
- What storage backend specifics?
- Any known issues or concerns?
Then validate the implementation:
-
Interface compliance check:
// Ensure all methods are implemented var _ replicate.ReplicaClient = (*YourClient)(nil) -
Verify error types:
// OpenLTXFile must return os.ErrNotExist for missing files _, err := client.OpenLTXFile(ctx, 0, 999, 999, 0, 0) if !errors.Is(err, os.ErrNotExist) { t.Errorf("Expected os.ErrNotExist, got %v", err) } -
Test partial reads:
// Must support offset and size parameters rc, err := client.OpenLTXFile(ctx, 0, 1, 100, 50, 25) data, _ := io.ReadAll(rc) if len(data) != 25 { t.Errorf("Expected 25 bytes, got %d", len(data)) } -
Verify timestamp preservation:
// CreatedAt should reflect remote object metadata (or upload time) start := time.Now() info, _ := client.WriteLTXFile(ctx, 0, 1, 100, reader) if info.CreatedAt.IsZero() || info.CreatedAt.Before(start.Add(-time.Second)) { t.Error("unexpected CreatedAt timestamp") } -
Test eventual consistency handling:
- Implement retry logic for transient failures
- Handle partial file availability
- Verify write-after-write consistency
-
Validate cleanup:
// DeleteAll must remove everything err := client.DeleteAll(ctx) files, _ := client.LTXFiles(ctx, 0, 0, false) if files.Next() { t.Error("Files remain after DeleteAll") }
Key validation points:
- Proper error types (os.ErrNotExist, os.ErrPermission)
- Context cancellation handling
- Concurrent operation safety
- Iterator doesn't load all files at once
- Proper path construction for storage backend
Run integration tests:
go test -v ./[backend]/replica_client_test.go -integration