From c8583c25b289ab2acee538add1462c5c05d1b635 Mon Sep 17 00:00:00 2001 From: Runxi Yu Date: Sat, 16 May 2026 09:55:16 +0000 Subject: object/store: Simplify; remove composited writer and quarantiner --- object/store/doc.go | 21 ++++++++++++--------- object/store/errors.go | 15 ++++++++++++--- object/store/quarantiner.go | 20 -------------------- object/store/writer.go | 10 ---------- 4 files changed, 24 insertions(+), 42 deletions(-) diff --git a/object/store/doc.go b/object/store/doc.go index 5dedd7a1..23a8951f 100644 --- a/object/store/doc.go +++ b/object/store/doc.go @@ -1,13 +1,16 @@ // Package store provides interfaces for object storage backends. // -// Reading stores only respond to object-ID queries in terms of headers (type -// and size), raw bytes, and streaming payloads, but they do not parse commits, -// trees, blobs, or tags into typed values. Turning stored objects into typed -// objects is the job of [codeberg.org/lindenii/furgit/object/fetch]. +// Reading stores only respond to object-ID queries +// in terms of headers (type and size), raw bytes, and streaming payloads, +// but they do not parse commits, trees, blobs, or tags into typed values. +// Turning stored objects into typed objects +// is the job of [codeberg.org/lindenii/furgit/object/fetch]. // -// This package does not define one unified writing interface. Backends have -// very different write models: writing one loose object is natural, while -// writing one object into a packfile backend is wasteful. Instead, we define -// distinct optional capabilities for object-wise writes, pack-wise writes, -// and compose them against quarantined writes. +// This package does not define one unified writing interface. +// Backends have very different write models: +// writing one loose object is natural, +// while writing one object into a packfile backend is wasteful. +// Instead, we define distinct optional capabilities +// for object-wise writes, pack-wise writes, etc., +// and compose them for quarantined writes. package store diff --git a/object/store/errors.go b/object/store/errors.go index 12bb8b28..74da4df1 100644 --- a/object/store/errors.go +++ b/object/store/errors.go @@ -2,7 +2,16 @@ package store import "errors" -// ErrObjectNotFound indicates that an object does not exist in a backend. -// This error must only be produced by object stores, when it has no -// specified object ID, but no other unexpected conditions were encountered. +// ErrObjectNotFound indicates that +// an object does not exist in a backend. +// This error must only be produced by object stores, +// when it has no specified object ID, +// but no other unexpected conditions were encountered. var ErrObjectNotFound = errors.New("objectstore: object not found") + +// This is a sentinel with no details, +// because it could be a frequent occurence, +// and allocating frequently on expected error paths +// would be extremely harmful to performance. +// Sometime, I will audit this again. +// TODO \ No newline at end of file diff --git a/object/store/quarantiner.go b/object/store/quarantiner.go index 4a2b7e02..a89ad20f 100644 --- a/object/store/quarantiner.go +++ b/object/store/quarantiner.go @@ -17,26 +17,6 @@ type QuarantineBase interface { Discard() error } -// Quarantine represents one quarantined write -// that accepts both object-wise and pack-wise writes. -type Quarantine interface { - QuarantineBase - Writer -} - -// QuarantineOptions controls the options -// for one coordinated quarantine creation. -type QuarantineOptions struct { - Object ObjectQuarantineOptions - Pack PackQuarantineOptions -} - -// Quarantiner creates coordinated quarantines -// that accept both object-wise and pack-wise writes. -type Quarantiner interface { - BeginQuarantine(opts QuarantineOptions) (Quarantine, error) -} - // ObjectQuarantine represents one quarantined object-wise write. type ObjectQuarantine interface { QuarantineBase diff --git a/object/store/writer.go b/object/store/writer.go index 828237f5..dd042ed8 100644 --- a/object/store/writer.go +++ b/object/store/writer.go @@ -8,14 +8,6 @@ import ( "codeberg.org/lindenii/furgit/object/typ" ) -// Writer represents a store -// that could perform both pack ingestions -// and individual object writes. -type Writer interface { - PackWriter - ObjectWriter -} - // ObjectWriter writes individual Git objects. type ObjectWriter interface { // WriteReaderContent writes one typed object content stream. @@ -62,8 +54,6 @@ type PackWriteOptions struct { // When nil, // external thin-base repair is disabled, // and unresolved thin deltas fail ingestion. - // - // TODO: Define the errors here? ThinBase Reader // Progress receives human-readable progress messages -- cgit v1.3.1-10-gc9f91