Documentation
¶
Index ¶
- Constants
- Variables
- func Cache[K comparable, V any](f func(in K) V) func(in K) V
- func CopyAttrs(dst, src string) error
- func NewReportGetter() (EventHandler, ReportGetter)
- func ReadSignatureEntry(path string) (SignatureEntry, SignatureStatus, error)
- type CachedSignature
- type ContentItem
- type ContentMetadata
- type ContentSource
- type ContentTarget
- type ContentWriter
- type Copyer
- type DecodedSignature
- type DeviceOption
- type Error
- type Event
- type EventFinished
- type EventHandler
- type EventReportError
- type EventSignatureCacheSummary
- type EventUpdateCount
- type EventUpdateJob
- type EventUpdateProgress
- type HashPolicy
- type Item
- type Job
- type Option
- func AccurateJob(src string, dsts []string) Option
- func Overwrite(b bool) Option
- func SetFromDevice(opts ...DeviceOption) Option
- func SetToDevice(opts ...DeviceOption) Option
- func WildcardJob(opts ...WildcardJobOption) Option
- func WithEventHandler(h EventHandler) Option
- func WithHash(b bool) Option
- func WithHashPolicy(policy HashPolicy) Option
- func WithLogger(logger *logrus.Logger) Option
- func WithProgressBar() Option
- func WithReadBuffer(items int) Option
- func WithResultBatch(items int) Option
- func WithResultBuffer(items int) Option
- func WithResultFlushInterval(d time.Duration) Option
- type ReadMode
- type ReadModeItem
- type Report
- type ReportGetter
- type Result
- type SignatureCacheSummary
- type SignatureEntry
- type SignatureStatus
- type SimpleJob
- type SourceDecoderItem
- type StreamCopyer
- type TargetEncoderItem
- type TargetResult
- type WildcardJobOption
- type XattrReader
Constants ¶
const ( ContentMaxXattrCount = 256 ContentMaxXattrNameBytes = 1 << 10 ContentMaxXattrValueBytes = 1 << 20 ContentMaxMetadataBytes = 4 << 20 )
Content endpoint metadata limits also bound native capture before allocating xattr buffers. The aggregate includes a conservative 64-byte framing allowance per attribute.
const ( JobStatusPending = "pending" JobStatusPreparing = "preparing" JobStatusCopying = "copying" JobStatusFinishing = "finishing" JobStatusFinished = "finished" )
Report row status vocabulary. A row is published once, when the item's data and metadata lifecycle has finished, so a completed and a failed item both read JobStatusFinished.
const UnexpectFileMode = os.ModeType &^ os.ModeDir
UnexpectFileMode is the file-mode mask a walk refuses to descend into.
Variables ¶
var ( ErrTargetNoSpace = fmt.Errorf("acp: target have no space") ErrTargetDropToReadonly = fmt.Errorf("acp: target droped into readonly") // ErrTargetIO reports an I/O failure of one target. Unlike ErrTargetDropToReadonly it does // not describe the whole device, so it must not abort a target that is still writable. ErrTargetIO = fmt.Errorf("acp: target have io error") )
var ErrEncodedContent = errors.New("acp: encoded content cannot be decoded")
ErrEncodedContent identifies a native source whose item decoder failed: an error from the decoder function or its reader, or plaintext that differs from the declared size. The native source's own read errors keep their identity instead.
var ErrMemberSettled = errors.New("acp: endpoint member failure is settled")
ErrMemberSettled marks an endpoint failure that ends only its own member. A content source that wraps it in an Open, Read or Close error, a content target that wraps it in an Open error and returns no writer, or a content writer that wraps it in its own Finish error has left its ordered stream at a usable boundary: that member fails, but later members are still admitted instead of the endpoint failure stopping the run. A writer settles only with a marker it adds itself: one it merely passes on from the cause Finish received, by returning, wrapping or joining that cause, does not count. A refused content target fails alone; the item's other targets continue. A content writer's own Write error always stops the run.
var ErrSourceRead = errors.New("read source failed")
ErrSourceRead identifies a failure of an item's source while its transfer runs: opening or observing a content source, reading or decoding a source, a content size mismatch, or closing the source. ACP wraps it wherever it reports that failure, in Result.Err or inside a TargetResult.Err, so a caller can tell a source failure from a target's own failure.
Functions ¶
func Cache ¶
func Cache[K comparable, V any](f func(in K) V) func(in K) V
func NewReportGetter ¶
func NewReportGetter() (EventHandler, ReportGetter)
NewReportGetter returns the event handler that collects one run's report and the getter that renders it. A row is keyed by the joined relative path of its item, and the getter emits the rows in that key's order, so the same items always produce the same document; the pipeline errors keep their arrival order.
func ReadSignatureEntry ¶ added in v0.2.10
func ReadSignatureEntry(path string) (SignatureEntry, SignatureStatus, error)
ReadSignatureEntry returns a regular file's managed entry and whether it is fresh. A stale entry is still returned, so a caller can see its Decoded marker when only the mtime changed. Missing and unsupported xattrs report SignatureMissing.
Types ¶
type CachedSignature ¶ added in v0.2.0
CachedSignature is a SHA-256 content signature of the bytes on disk, bound to file metadata.
func DecodeCachedSignature ¶ added in v0.2.0
func DecodeCachedSignature(encoded []byte) (CachedSignature, error)
DecodeCachedSignature decodes the plain view of a managed xattr value, in either encoding. It fails for an entry without a SHA-256 of the bytes on disk.
func ReadCachedSignature ¶ added in v0.2.0
func ReadCachedSignature(path string) (CachedSignature, bool, error)
ReadCachedSignature returns the plain signature of the bytes on disk only when the entry's size and mtime still match the regular file and the entry has that hash. Missing, stale, decoded-only and unsupported xattrs are cache misses.
type ContentItem ¶ added in v0.2.7
type ContentItem interface {
Item
ContentSource() ContentSource
ContentTargets() []ContentTarget
}
ContentItem optionally supplies stream endpoints. A nil source selects the native Source path. ContentTargets is either nil or aligned with Targets; nil entries select native target paths. Each endpoint side requires LinearDevice(true); content sources require buffered reads. At most one target endpoint is supported per item. Native sides retain their device options.
type ContentMetadata ¶ added in v0.2.7
ContentMetadata is an immutable snapshot observed when a source opens. Endpoint implementations retain ownership of their input; ACP copies the snapshot before forwarding it to targets.
type ContentSource ¶ added in v0.2.7
ContentSource opens one member in an ordered content stream. ACP observes Stat and optional Xattrs once before opening targets. ACP owns any returned file, even alongside an error, and closes it once before another member opens or its native outputs can be committed.
func SourceFromFS ¶ added in v0.2.7
func SourceFromFS(fsys fs.FS, name string) ContentSource
SourceFromFS binds a filesystem and its relative, slash-delimited name without opening it. ACP opens the file in the ordered source lane, observes Stat and optional Xattrs, and owns Close. Invalid names and a nil filesystem fail that item before target creation. The filesystem must remain disjoint from native outputs; ACP cannot identify aliases hidden behind an fs.FS.
type ContentTarget ¶ added in v0.2.7
type ContentTarget interface {
Open(context.Context, ContentMetadata) (ContentWriter, error)
}
ContentTarget opens one member using observed source metadata. Its matching target string is a display identifier, never a filesystem path.
type ContentWriter ¶ added in v0.2.7
ContentWriter receives member bytes. ACP calls Finish exactly once after writes stop, passing the transfer failure, if any; Finish must not publish a truncated member as successful.
type Copyer ¶
type Copyer struct {
// contains filtered or unexported fields
}
Copyer is the af05f05c compatibility shell: the same job options, events and JSON report as the commit that predates the streaming API, built on the push engine.
New enumerates the requested jobs, submits every selected file to a StreamCopyer, and translates each result into the terminal report row event the CLI, Report and NewReportGetter machinery reads. Wait/WaitErr close that stream and report how the run ended.
func New ¶
New builds a shell run. Creation and validation errors, such as a target that is not a directory or a source that does not exist, come back from New; an enumeration error, such as two sources mapping to the same relative path, ends the run and comes back from WaitErr.
type DecodedSignature ¶ added in v0.2.10
type DecodedSignature struct {
// Encoding is the caller-defined, non-empty encoding name.
Encoding string
// Size is the decoded size.
Size int64
// SHA256 is the SHA-256 of the decoded content; empty when unknown.
SHA256 []byte
}
DecodedSignature describes the decoded content of an encoded file.
type DeviceOption ¶
type DeviceOption func(*deviceOption) *deviceOption
func DeviceThreads ¶
func DeviceThreads(threads int) DeviceOption
func LinearDevice ¶
func LinearDevice(b bool) DeviceOption
func RefreshSignatureCache ¶ added in v0.2.9
func RefreshSignatureCache(b bool) DeviceOption
RefreshSignatureCache selects whether a refreshing hash policy writes computed signatures onto this device's files: sources on the source device, written targets on the target device. It defaults to true and never changes hashing or reuse of stored signatures.
func WithReadMode ¶ added in v0.2.1
func WithReadMode(mode ReadMode) DeviceOption
WithReadMode selects how a source device reads its content. It applies to the source device only and defaults to buffered reads.
type Error ¶
type Error struct {
Src string `json:"src,omitempty"`
Dst string `json:"dst,omitempty"`
Err error `json:"error,omitempty"`
}
Error is one pipeline-level failure. Its JSON form stores the message, so a report stays readable with encoding/json and an absent error stays absent.
func (*Error) MarshalJSON ¶
MarshalJSON encodes the message of an error. A missing error stays missing: it is omitted instead of being rendered from a nil value, so marshalling cannot panic on the nil errors UnmarshalJSON can produce.
func (*Error) UnmarshalJSON ¶
UnmarshalJSON decodes the object form or null. An absent or empty message leaves Err nil, so a round trip neither loses an error nor invents one.
type EventFinished ¶
type EventFinished struct{}
type EventHandler ¶
type EventHandler func(Event)
EventHandler observes the events of one run. ACP calls it from one goroutine per registration and never concurrently, so a handler may keep unguarded state between events. WithEventHandler is last-wins, so a run has at most one handler.
func NewProgressBar ¶
func NewProgressBar() EventHandler
type EventReportError ¶
type EventReportError struct {
Error *Error
}
type EventSignatureCacheSummary ¶ added in v0.2.0
type EventSignatureCacheSummary struct {
Summary SignatureCacheSummary
}
EventSignatureCacheSummary reports aggregate cache behavior for one Copyer.
type EventUpdateCount ¶
type EventUpdateJob ¶
type EventUpdateJob struct {
Job *Job
}
type EventUpdateProgress ¶
type HashPolicy ¶ added in v0.2.1
type HashPolicy uint8
HashPolicy selects how an item's content hash is produced and how the stored hash cache is used. Hashing and the cache are one policy, because refreshing the cache requires a computed hash: a miss under a refresh-enabled value must read.
A targetless item may reuse a stored hash, because it records content facts without writing the content anywhere. A transfer always reads its source and produces a computed hash, so the two reuse-only values are rejected for an item that requests targets.
const ( // HashOff produces no hash and leaves the cache untouched. HashOff HashPolicy = iota // HashCachedOnly reuses a stored hash for a targetless item; a miss leaves the item // without a hash. Rejected for an item with targets. HashCachedOnly // HashCachedOrRead reuses a stored hash for a targetless item; a miss reads and hashes // without refreshing. Rejected for an item with targets, because a copy always reads and // a reused hash would then describe content the transfer never computed. HashCachedOrRead // HashCachedOrReadRefresh reuses a stored hash for a targetless item; a miss reads, // hashes and refreshes. A transfer always reads, hashes and refreshes. HashCachedOrReadRefresh // HashRead always reads and hashes; the cache is not refreshed. A targetless item // ignores its stored hash, and a transfer hashes the content it copies. HashRead // HashReadRefresh always reads and hashes, and refreshes the cache. HashReadRefresh )
func (HashPolicy) String ¶ added in v0.2.1
func (p HashPolicy) String() string
type Item ¶ added in v0.2.1
type Item interface {
// Source returns the exact native path to read, or the content source display identifier.
Source() string
// Targets returns native paths or content target display identifiers. An empty slice writes nothing: the source is
// read and hashed only when the hash policy produces a hash, so the default HashOff reports
// neither a copy nor a hash.
Targets() []string
}
Item is one unit of work owned by the caller.
The caller implements Item over whatever state it owns, so the item is the handle that ties a result back to that state: Result.Job is the exact instance that was submitted, and no id lookup or payload plumbing is needed. ACP calls Source and Targets under panic protection: the first call describes the item, and an item whose description failed is asked for its Source once more when it is reported, so a failure path may read Source twice. ACP never keeps the item afterwards.
type Job ¶
type Job struct {
Base string `json:"base"`
Path []string `json:"path"`
Status string `json:"status"`
SuccessTargets []string `json:"success_target,omitempty"`
FailTargets map[string]error `json:"fail_target,omitempty"`
Size int64 `json:"size"`
Mode fs.FileMode `json:"mode"`
ModTime time.Time `json:"mod_time"`
WriteTime time.Time `json:"write_time"`
SHA256 string `json:"sha256"`
FullPath string `json:"full_path,omitempty"`
SignatureCacheHit bool `json:"signature_cache_hit,omitempty"`
}
Job is one report row in the af05f05c shape: Base is the directory the source-relative Path is resolved against, and Path holds the source-relative path segments that also map onto a target directory, so the row's JSON carries path as an array. It is part of the public report contract, so it is a plain data structure that a report reader can decode with encoding/json alone.
FullPath and SignatureCacheHit are additive fields. FullPath names the source file as one whole path, which a consumer that does not join Base and Path needs, and SignatureCacheHit reports where the content hash came from; both stay empty on a row that does not record them.
func (*Job) MarshalJSON ¶ added in v0.2.1
MarshalJSON renders one report row with encoding/json. A row is part of the public report contract, so it must be readable and writable without ACP's own JSON coders.
func (*Job) UnmarshalJSON ¶ added in v0.2.1
UnmarshalJSON reads one report row back. A null or empty failure message leaves the target out of the map instead of turning it into an error that was never recorded.
type Option ¶
type Option func(*option) *option
Option configures one run. A repeated value option is last-wins, so a later value replaces an earlier one instead of combining with it; the job options and SetFromDevice/SetToDevice accumulate, so a second WildcardJob adds another walk and a second device option adjusts the same device description.
func AccurateJob ¶
AccurateJob copies one exact source to the given destination paths, without mapping a relative path onto a target directory.
func Overwrite ¶
Overwrite selects whether an existing target file is replaced or refused. It is a run-level option and applies to every requested target.
func SetFromDevice ¶
func SetFromDevice(opts ...DeviceOption) Option
func SetToDevice ¶
func SetToDevice(opts ...DeviceOption) Option
func WildcardJob ¶
func WildcardJob(opts ...WildcardJobOption) Option
WildcardJob copies every regular file below the given sources into every target directory, keeping each file's source-relative path.
func WithEventHandler ¶
func WithEventHandler(h EventHandler) Option
WithEventHandler registers the run's event handler. Repeated options are last-wins, so this replaces every handler registered before it, and a nil handler clears the registration instead of leaving a handler that fails the run when it is called.
func WithHash ¶
WithHash selects whether the run computes a content hash and refreshes the stored hash cache. It is the af05f05c form of WithHashPolicy: true maps to HashReadRefresh and false to HashOff, and a repeated hash option is last-wins.
func WithHashPolicy ¶ added in v0.2.1
func WithHashPolicy(policy HashPolicy) Option
WithHashPolicy sets the content hash policy, which also decides how the stored hash cache is read and refreshed. It defaults to HashOff.
func WithLogger ¶
func WithProgressBar ¶
func WithProgressBar() Option
func WithReadBuffer ¶ added in v0.2.1
WithReadBuffer sets how many items ACP may hold in its read buffer, which is also the feed's backpressure limit: Submit blocks while the buffer is full. It defaults to 4096 items.
func WithResultBatch ¶ added in v0.2.1
WithResultBatch sets how many results one delivery carries: ACP hands the caller's results callback at most this many results at a time. It defaults to 256 items.
func WithResultBuffer ¶ added in v0.2.1
WithResultBuffer sets how many finished results ACP may hold for delivery, which is the backpressure limit of the result path: a pipeline stage that produces a result blocks while the result buffer is full. A result that carries an error is delivered as soon as it is read, so it does not wait for room in a batch. It defaults to 256 items.
func WithResultFlushInterval ¶ added in v0.2.1
WithResultFlushInterval sets how long a successful result may wait for the rest of its batch. It defaults to one second and accepts no value below 100ms.
type ReadMode ¶ added in v0.2.1
type ReadMode uint8
ReadMode selects how a source device reads its content.
type ReadModeItem ¶ added in v0.2.2
type ReadModeItem interface {
ReadMode() ReadMode
}
ReadModeItem optionally selects how one item's source content is read. Items that do not implement it use the source device mode set by WithReadMode, which defaults to ReadBuffered. ACP calls ReadMode once while indexing a describable item. A panic or invalid mode fails only that item; it does not stop the run.
type Report ¶
type Report struct {
Jobs []*Job `json:"files,omitempty"`
Errors []*Error `json:"errors,omitempty"`
}
Report is the JSON document of one run: one row per accepted item plus the pipeline-level errors. The standard library encodes and decodes it as-is, so a consumer needs no ACP coder to read what ACP wrote.
func (*Report) ToJSONString ¶
ToJSONString renders the report. Indentation is two spaces, because a JSON encoder accepts nothing else and a report writer must never panic while it is producing a document. It returns an empty string on encoding failure; use json.Marshal to inspect the error.
type ReportGetter ¶
type ReportGetter func() *Report
type Result ¶ added in v0.2.1
type Result struct {
// Job is the exact Item instance that was submitted.
Job Item
// Err is the item-level error. A nil Err means the item completed, even when every
// requested target failed: an item that could not be processed at all is what fails,
// and its target outcomes are still reported.
Err error
// Size, Mode and ModTime describe the source facts the item observed, and WriteTime is
// when its copy stage started. A decoded source reports its declared plaintext Size.
Size int64
Mode fs.FileMode
ModTime time.Time
WriteTime time.Time
// SHA256 is the hash of the bytes actually read; it is nil when the hash policy produces
// no hash. SignatureCacheHit reports that a stored hash was reused instead of computed.
SHA256 []byte
SignatureCacheHit bool
// Targets holds one outcome per requested target, in request order. A target that was
// not written still has an outcome.
Targets []TargetResult
}
Result reports the content facts of one finished item, one outcome per requested target, and the item's own error.
A result that carries an error is delivered as soon as it is produced; results without an error are buffered. Result order is unspecified: results arrive in completion order, and a failure may therefore arrive before a success of the same submission batch. A linear target still writes in request order, because one writer consumes items in that order.
type SignatureCacheSummary ¶ added in v0.2.0
type SignatureCacheSummary struct {
Hits int64 `json:"hits"`
Misses int64 `json:"misses"`
Stale int64 `json:"stale"`
Writes int64 `json:"writes"`
Failures int64 `json:"failures"`
FirstError string `json:"first_error,omitempty"`
Samples []string `json:"samples,omitempty"`
}
SignatureCacheSummary describes cache activity for one Copyer run.
type SignatureEntry ¶ added in v0.2.10
type SignatureEntry struct {
Size int64
MtimeNS int64
SHA256 []byte
Decoded *DecodedSignature
}
SignatureEntry is the managed signature xattr of a file. Size and MtimeNS describe the file on disk and decide freshness; SHA256 is the hash of the bytes on disk and is empty when unknown. Decoded is present only for an encoded file, where the entry is also the marker that the file is encoded.
func DecodeSignatureEntry ¶ added in v0.2.10
func DecodeSignatureEntry(encoded []byte) (SignatureEntry, error)
DecodeSignatureEntry decodes the managed xattr value: the Protobuf form, or the legacy fixed-size layout that begins with the legacy magic.
type SignatureStatus ¶ added in v0.2.10
type SignatureStatus uint8
SignatureStatus tells whether a file's managed signature entry describes its current version.
const ( // SignatureMissing means the file has no entry, or its file system has no managed attribute. SignatureMissing SignatureStatus = iota // SignatureStale means the entry's size or mtime no longer match the file. SignatureStale // SignatureFresh means the entry's size and mtime match the file. SignatureFresh )
type SimpleJob ¶ added in v0.2.1
SimpleJob is an Item that carries no state of its own: Path is the source and Dsts are the destinations. A caller that submits a SimpleJob finds its result by matching Result.Job against the pointer it submitted, because SimpleJob has no callback of its own.
type SourceDecoderItem ¶ added in v0.2.10
type SourceDecoderItem interface {
SourceDecoder() (encoding string, decode func(src io.Reader) (io.ReadCloser, error), size int64)
}
SourceDecoderItem optionally decodes one item's native source. ACP calls SourceDecoder once while indexing; a nil decode reads plaintext, and a non-nil one requires a non-empty encoding name of at most 64 bytes. size is the plaintext size: it replaces the stored file's size in results, progress, read-ahead and target allocation, and the decoded bytes must match it. When the source starts reading, ACP calls decode with the opened native reader and reads plaintext from the returned reader until io.EOF; it closes that reader once before the native descriptor. A decoded source reuses and refreshes only the decoded part of the managed signature entry, for its encoding and size, and requires native targets.
type StreamCopyer ¶ added in v0.2.1
type StreamCopyer struct {
// contains filtered or unexported fields
}
StreamCopyer is the push engine. The caller submits items, ACP reports every accepted item through one results callback, and Wait returns the run's terminal error.
A run has exactly one cancellation checkpoint: Submit consults the context, the results callback error and an exhausted linear target before it accepts a batch. Every later stage runs on a context that never cancels, so it only drains and forwards what it holds; a stage that pulls an item it can no longer start marks it with the stopping reason, and the results stage is the only goroutine that invokes the caller's callback. A graceful stop therefore gives every accepted item exactly one result.
func NewStream ¶ added in v0.2.1
func NewStream(ctx context.Context, onResults func([]Result) error, opts ...Option) (*StreamCopyer, error)
NewStream builds a push engine. It returns creation and validation errors: a nil results callback, an invalid option combination, or a job option that only the New shell can honour.
onResults is called from one goroutine, never concurrently. An error it returns is handled as a cancellation: already accepted items finish and are delivered normally, items still inside the read pipeline are delivered as failures with that error, the batch in hand is still submitted, the next Submit returns an error, and Wait returns it. A result that carries any error is delivered immediately as its own batch; results without an error are buffered until the delivery reaches WithResultBatch results, the result flush interval elapses, or Close flushes them.
func (*StreamCopyer) Close ¶ added in v0.2.1
func (c *StreamCopyer) Close() error
Close ends the feed and drains the run: every item already submitted finishes and all dependent cache and Close work settle, the remaining results are flushed, and the run's cache summary is reported. It returns the flush error, and it is safe to call more than once.
func (*StreamCopyer) HardStopped ¶ added in v0.2.7
func (c *StreamCopyer) HardStopped() <-chan struct{}
HardStopped returns a channel closed when a fatal pipeline failure ends per-item accounting. It does not signal normal completion, graceful stopping or physical source settlement. Call Close and Wait to settle resources and obtain the run's authoritative terminal error.
func (*StreamCopyer) Submit ¶ added in v0.2.1
func (c *StreamCopyer) Submit(items ...Item) error
Submit accepts items. It blocks while the read buffer is full, so a caller that produces work faster than the pipeline reads it is slowed down instead of growing memory, and it returns an error once the run accepts no more work: after Close, after the context ended, after the results callback returned an error, or after a fatal pipeline failure.
A single submitter is required, and Items must be submitted before Close. A nil item is a submission error that does not end the feed: it is recorded as the run's error, so Wait reports it, and the items submitted after it are still accepted.
func (*StreamCopyer) Wait ¶ added in v0.2.1
func (c *StreamCopyer) Wait() error
Wait drains the run and returns its terminal error: a pipeline failure, a submission error, an error the results callback returned, or a flush failure. It is the authoritative outlet for run-time errors, and a caller that stopped the run gracefully reads the stopping error here.
type TargetEncoderItem ¶ added in v0.2.10
type TargetEncoderItem interface {
TargetEncoder() (encoding string, encode func(dst io.Writer) (io.WriteCloser, error))
}
TargetEncoderItem optionally encodes every native target of one item. ACP calls TargetEncoder once while indexing; a nil encode writes plaintext, and a non-nil one requires a non-empty encoding name of at most 64 bytes. For each native output ACP calls the encoder with that output's file writer, writes the item's plaintext into the returned writer and closes it once after the last write. Close flushes the encoded tail into dst and returns only after every write into dst has finished. An encoded target is never preallocated and always receives a managed signature entry that names the encoding and describes the plaintext; the entry marks the file as encoded, so a failure to write it fails that target. Content targets are not encoded.
type TargetResult ¶ added in v0.2.1
type TargetResult struct {
Path string
// Size is the item's size as read, so a failed or partially written target reports that
// size rather than a count of the bytes that landed there.
Size int64
// StoredSize counts the bytes ACP wrote to a written native target: Size, or the encoded
// size when the item encodes its targets. It is zero for a failed or content target.
StoredSize int64
WriteTime time.Time
// Err is nil when the target was written. Target failures keep their error identity, so
// errors.Is(err, ErrTargetNoSpace) identifies an exhausted medium.
Err error
}
TargetResult is the outcome of one requested target.
type WildcardJobOption ¶
type WildcardJobOption func(*wildcardJob) *wildcardJob
WildcardJobOption configures one WildcardJob.
func AccurateSource ¶
func AccurateSource(base string, paths ...[]string) WildcardJobOption
AccurateSource adds sources as base plus relative path segments to a WildcardJob.
func Source ¶
func Source(paths ...string) WildcardJobOption
Source adds source paths to a WildcardJob. A source may be a directory or a regular file.
func Target ¶
func Target(paths ...string) WildcardJobOption
Target adds target directories to a WildcardJob. Every one of them must exist.
type XattrReader ¶ added in v0.2.7
XattrReader optionally supplies ordinary attributes from an opened content source. Values are opaque bytes. Providers normalize missing or unsupported attribute facilities to an empty map.
Source Files
¶
- acp.go
- attrs.go
- cache.go
- cleanup.go
- compat.go
- content_metadata.go
- content_source.go
- copy.go
- disk_usage.go
- error.go
- event.go
- filesystem.go
- fs.go
- hash_policy.go
- index.go
- item.go
- job.go
- opt.go
- opt_device.go
- prepare.go
- progress_bar.go
- read_ahead.go
- recover.go
- report.go
- signature.go
- signature_xattr_linux.go
- signature_xattr_unix.go
- stat.go
- syscall_linux.go
- syscall_noatime_linux.go
- syscall_unix.go
- target.go
- transfer.go
- transfer_read.go
- transfer_target.go
Directories
¶
| Path | Synopsis |
|---|---|
|
cmd
|
|
|
acp
command
|
|
|
acp-rewrite
command
|
|
|
internal
|
|
|
fileio
Package fileio owns temporary command files and atomic JSON replacement.
|
Package fileio owns temporary command files and atomic JSON replacement. |
|
signaturepb
Package signaturepb holds the Protobuf form of the managed signature xattr entry.
|
Package signaturepb holds the Protobuf form of the managed signature xattr entry. |
|
Package mmap provides a way to memory-map a file.
|
Package mmap provides a way to memory-map a file. |