summaryrefslogtreecommitdiff
path: root/appl/lib
diff options
context:
space:
mode:
authorVenkatesh Srinivas <vsrinivas@ops101.org>2025-03-27 14:21:40 +0000
committerVenkatesh Srinivas <vsrinivas@ops101.org>2025-03-27 14:21:40 +0000
commit30edc625bd8381f4efe736d1fab2e8c6d38c50a5 (patch)
treef1cd8a62bfaf379e1d7bcb0641c1e586bea74667 /appl/lib
parent2279329d3013d42db413cddc01b9cd9e08ddab12 (diff)
venti: Session.read(): Handle reads for 0-score/any type locally
vac archives may have the zero-score (da39...) with any type. I've observed type VtDirType + 3, for a single 720 MiB file, for example. The reference venti server will not find zero-score blocks with type != 0; and the reference client does not send reads for zero-score blocks regardless of type (see libventi/client.c: vtreadpacket). Implement the same logic in venti.b.
Diffstat (limited to 'appl/lib')
-rw-r--r--appl/lib/venti.b4
1 files changed, 4 insertions, 0 deletions
diff --git a/appl/lib/venti.b b/appl/lib/venti.b
index cfb3a8ec..d2f9db9a 100644
--- a/appl/lib/venti.b
+++ b/appl/lib/venti.b
@@ -323,6 +323,10 @@ Session.new(fd: ref Sys->FD): ref Session
Session.read(s: self ref Session, score: Score, etype: int, maxn: int): array of byte
{
+ if (Score.eq(score, Score.zero()) {
+ return array[0] of byte;
+ }
+
(gm, err) := s.rpc(ref Vmsg.Tread(1, 0, score, etype, maxn));
if(gm == nil){
sys->werrstr(err);