aboutsummaryrefslogtreecommitdiff
path: root/object/store/writer_pack.go
blob: 0f78c429972333f3b8590bd5b4e91ef40f09d026 (about) (plain) (blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
package objectstore

import (
	"io"

	"codeberg.org/lindenii/furgit/common/iowrap"
)

// PackWriteOptions controls one pack write operation.
type PackWriteOptions struct {
	// ThinBase supplies the wider object reader used to complete thin packs
	// during ingestion.
	//
	// This is an option for the write operation rather than on a particular
	// pack-backed store because any pack-accepting store is not generally
	// expected to know the entire repository object universe around it.
	// In a normal repository, thin bases usually come from a broader view
	// such as mix(loose, packed), and should not be treated as a property of
	// the destination pack-accepting store. Thus, in almost all pack-ingesting
	// operations, a thin base reader would be required, and hence it is
	// included here.
	//
	// When nil, external thin-base repair is disabled and unresolved thin deltas
	// fail ingestion.
	ThinBase Reader

	// Progress receives human-readable progress messages.
	//
	// When nil, no progress output is emitted.
	Progress iowrap.WriteFlusher

	// RequireTrailingEOF requires the source to hit EOF after the pack trailer.
	//
	// This is suitable for exact pack-file readers, but should be disabled for
	// full-duplex transport streams like receive-pack where the peer keeps the
	// connection open to read the server response.
	RequireTrailingEOF bool
}

// PackWriter writes Git pack streams.
type PackWriter interface {
	// WritePack ingests one pack stream.
	WritePack(src io.Reader, opts PackWriteOptions) error
}

// PackQuarantine represents one quarantined pack-wise write.
type PackQuarantine interface {
	BaseQuarantine
	PackWriter
}

// PackQuarantineOptions controls the options for one pack quarantine creation.
type PackQuarantineOptions struct{}

// PackQuarantiner creates quarantines for pack-wise writes.
type PackQuarantiner interface {
	BeginPackQuarantine(opts PackQuarantineOptions) (PackQuarantine, error)
}