Documentation
¶
Overview ¶
Package runnerstate owns the private Linux runner directory and runtime lock.
Index ¶
- Constants
- Variables
- type ContentFileIdentity
- type ContentReader
- func (reader *ContentReader) Check() error
- func (reader *ContentReader) Close() error
- func (reader *ContentReader) PhysicalIdentity(storeID string) (ContentFileIdentity, error)
- func (reader *ContentReader) Read(buffer []byte) (int, error)
- func (reader *ContentReader) Seek(offset int64, whence int) (int64, error)
- type ContentStoreIdentity
- type ContentStoreMarker
- type State
- func (state *State) AvailableBytes() (uint64, error)
- func (state *State) Close() error
- func (state *State) ContentFiles(ctx context.Context) (count uint64, err error)
- func (state *State) EnsureContentStore(ctx context.Context, installationID string, at time.Time) (*ContentStoreMarker, error)
- func (state *State) OpenContent(ctx context.Context, identity jobcontract.ContentIdentity) (reader *ContentReader, err error)
- func (state *State) Path() string
- func (state *State) PutContent(ctx context.Context, identity jobcontract.ContentIdentity, source io.Reader) (created bool, err error)
- func (state *State) ReadPrivate(name string, limit int64) ([]byte, error)
- func (state *State) ReplacePrivate(name string, document []byte) error
- func (state *State) SyncPrivate(name string) error
- func (state *State) UsedBytes(ctx context.Context) (uint64, error)
- func (state *State) WriteNew(name string, document []byte) error
Constants ¶
const ContentStoreName = "content-store.json"
const MaxContentStoreBytes = 2 << 10
Variables ¶
var ( ErrInvalid = errors.New("invalid_runner_state") ErrLocked = errors.New("runner_already_running") )
var ErrContentCorrupt = errors.New("invalid_runner_content")
Functions ¶
This section is empty.
Types ¶
type ContentFileIdentity ¶
type ContentReader ¶
type ContentReader struct {
// contains filtered or unexported fields
}
ContentReader is a verified, seekable private file. State.Close closes its descriptor; cancellation affects only this stream. Read and Seek reject a replaced file or state directory without rehashing the complete file.
func (*ContentReader) Check ¶
func (reader *ContentReader) Check() error
func (*ContentReader) Close ¶
func (reader *ContentReader) Close() error
func (*ContentReader) PhysicalIdentity ¶
func (reader *ContentReader) PhysicalIdentity(storeID string) (ContentFileIdentity, error)
PhysicalIdentity binds the verified open file to its kernel birth identity. Unsupported filesystems fail explicitly; ctime never substitutes for btime.
type ContentStoreIdentity ¶
type ContentStoreMarker ¶
type ContentStoreMarker struct {
// contains filtered or unexported fields
}
func (*ContentStoreMarker) Check ¶
func (marker *ContentStoreMarker) Check(ctx context.Context) error
func (*ContentStoreMarker) Identity ¶
func (marker *ContentStoreMarker) Identity() ContentStoreIdentity
type State ¶
type State struct {
// contains filtered or unexported fields
}
func Open ¶
Open holds an advisory runtime lock until Close. The inode is retained after release so another process cannot accidentally lock a replacement inode.
func (*State) AvailableBytes ¶
func (*State) ContentFiles ¶
ContentFiles counts retained complete files and scratch names, including malformed or failed content names. They continue consuming admission quota.
func (*State) EnsureContentStore ¶
func (*State) OpenContent ¶
func (state *State) OpenContent( ctx context.Context, identity jobcontract.ContentIdentity, ) (reader *ContentReader, err error)
func (*State) PutContent ¶
func (state *State) PutContent( ctx context.Context, identity jobcontract.ContentIdentity, source io.Reader, ) (created bool, err error)
PutContent verifies every incoming body, including duplicate uploads. Only a nil error confirms durable publication; created then distinguishes a new file from existing identical content. Failed partials and corrupt files are kept. A blocking source reader must honor ctx itself, as an HTTP request body does.
func (*State) ReadPrivate ¶
func (*State) ReplacePrivate ¶
ReplacePrivate atomically replaces a mutable private control document. The runtime lock and its owning controller serialize writers; identities use WriteNew.
func (*State) SyncPrivate ¶
SyncPrivate confirms both file content and its directory entry are durable.