Fast implementation of Git in pure Go codeberg.org/lindenii/furgit
git go
6
fork

Configure Feed

Select the types of activity you want to include in your feed.

object/store: Add quarantine and writer interfaces

Runxi Yu 05a193c9 85ee911b

+67
+41
object/store/quarantine.go
··· 1 + package objectstore 2 + 3 + // Quarantine is one quarantined write. It is intended to be embedded. 4 + type Quarantine interface { 5 + // Reader returns the objects written into this quarantine. 6 + Reader() Reader 7 + 8 + // Promote publishes quarantined writes into their final destination. 9 + Promote() error 10 + 11 + // Discard abandons quarantined writes. 12 + Discard() error 13 + } 14 + 15 + // ObjectQuarantine represents one quarantined object-wise write. 16 + type ObjectQuarantine interface { 17 + Quarantine 18 + ObjectWriter 19 + } 20 + 21 + // PackQuarantine represents one quarantined pack-wise write. 22 + type PackQuarantine interface { 23 + Quarantine 24 + PackWriter 25 + } 26 + 27 + // ObjectQuarantineOptions controls the options for one object quarantine creation. 28 + type ObjectQuarantineOptions struct{} 29 + 30 + // PackQuarantineOptions controls the options for one pack quarantine creation. 31 + type PackQuarantineOptions struct{} 32 + 33 + // ObjectQuarantiner creates quarantines for object-wise writes. 34 + type ObjectQuarantiner interface { 35 + BeginObjectQuarantine(opts ObjectQuarantineOptions) (ObjectQuarantine, error) 36 + } 37 + 38 + // PackQuarantiner creates quarantines for pack-wise writes. 39 + type PackQuarantiner interface { 40 + BeginPackQuarantine(opts PackQuarantineOptions) (PackQuarantine, error) 41 + }
+26
object/store/writer.go
··· 1 + package objectstore 2 + 3 + import ( 4 + "io" 5 + 6 + objectid "codeberg.org/lindenii/furgit/object/id" 7 + objecttype "codeberg.org/lindenii/furgit/object/type" 8 + ) 9 + 10 + // ObjectWriter writes individual Git objects. 11 + type ObjectWriter interface { 12 + // WriteContent writes one typed object content stream. 13 + WriteContent(ty objecttype.Type, size int64, src io.Reader) (objectid.ObjectID, error) 14 + 15 + // WriteFull writes one full serialized object stream as "type size\0content". 16 + WriteFull(src io.Reader) (objectid.ObjectID, error) 17 + } 18 + 19 + // PackWriteOptions controls one pack write operation. 20 + type PackWriteOptions struct{} 21 + 22 + // PackWriter writes Git pack streams. 23 + type PackWriter interface { 24 + // WritePack ingests one pack stream. 25 + WritePack(src io.Reader, opts PackWriteOptions) error 26 + }