Documentation
¶
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Content ¶
type Content interface {
// Panic if any internal invariants are violated.
CheckInvariants()
// Destroy any state used by the object, putting it into an indeterminate
// state. The object must not be used again.
Destroy()
// If the content has been dirtied from its initial state, return a
// read/write lease for the current content. Otherwise return nil.
//
// If this method returns a non-nil read/write lease, the Content is
// implicitly destroyed and must not be used again.
Release() (rwl lease.ReadWriteLease)
// Read part of the content, with semantics equivalent to io.ReaderAt aside
// from context support.
ReadAt(ctx context.Context, buf []byte, offset int64) (n int, err error)
// Return information about the current state of the content.
Stat(ctx context.Context) (sr StatResult, err error)
// Write into the content, with semantics equivalent to io.WriterAt aside from
// context support.
WriteAt(ctx context.Context, buf []byte, offset int64) (n int, err error)
// Truncate our the content to the given number of bytes, extending if n is
// greater than the current size.
Truncate(ctx context.Context, n int64) (err error)
}
A mutable view on some content. Created with an initial read-only view, which then can be modified by the user and read back. Keeps track of which portion of the content has been dirtied.
External synchronization is required.
type StatResult ¶
type StatResult struct {
// The current size in bytes of the content.
Size int64
// It is guaranteed that all bytes in the range [0, DirtyThreshold) are
// unmodified from the original content with which the mutable content object
// was created.
DirtyThreshold int64
// The time at which the content was last updated, or nil if we've never
// changed it.
Mtime *time.Time
}
Click to show internal directories.
Click to hide internal directories.