Documentation
¶
Overview ¶
Package nodesource transports exact source bytes on a private mTLS endpoint. It installs no routes and owns neither source Close nor encoder retirement.
Index ¶
- Constants
- type Authority
- type Client
- type ClientOptions
- type Grant
- type Handler
- type Hold
- type Options
- type Peer
- type Reader
- func (r *Reader) Close() error
- func (r *Reader) Done() <-chan struct{}
- func (r *Reader) Name() string
- func (r *Reader) ReadAt(b []byte, off int64) (int, error)
- func (r *Reader) ReadAtContext(ctx context.Context, b []byte, off int64) (int, error)
- func (r *Reader) ReleaseID() string
- func (r *Reader) Renew(ctx context.Context, authority func(context.Context, Grant) (Grant, error)) error
- func (r *Reader) Size() int64
- type Scope
Constants ¶
const CredentialHeader = "X-Ether-Source-Grant"
const Path = "/internal/source/v1/bytes"
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Authority ¶
Verify checks current placement, viewer policy and source revocation. It must bind the opaque credential to the complete scope; a certificate is not a grant.
type Client ¶
type Client struct {
// contains filtered or unexported fields
}
func NewClient ¶
func NewClient(o ClientOptions) (*Client, error)
type ClientOptions ¶
type ClientOptions struct {
Endpoint string
TLS *tls.Config
BindServer func(tls.ConnectionState) error
RecheckServer func(context.Context, tls.ConnectionState) error
Peer Peer
MaxLifetime time.Duration
Timeout time.Duration
Now func() time.Time
}
ClientOptions is trusted composition, never a public request payload. Endpoint is one fixed HTTPS origin with Path. TLS performs ordinary Go chain/hostname verification BEFORE BindServer. Peer is this client's certificate boot identity. RecheckServer is required current per-operation trust, composed with Guard. Each operation uses fresh TLS; rebuild after rotation. Callbacks and opaque signer keys must remain immutable and callbacks must honor their context.
type Handler ¶
type Handler struct {
// contains filtered or unexported fields
}
func NewHandler ¶
func (*Handler) Pending ¶
Pending returns exact-scope hold count, including cancelled/expired requests. A zero count proves only that transport holds have been relinquished, never source Close, encoder retirement or durable placement retirement.
func (*Handler) Reconcile ¶
Reconcile is called by the host lifecycle, including after drain/expiry and when no more requests arrive. It never treats elapsed time as retirement. Pending includes active, cancelled and disconnected requests with producers. No callbacks run under registry locks. There are no background goroutines.
type Hold ¶
type Hold struct {
Scope Scope
Source core.MediaSource
Release func()
}
Hold must refer to the exact acquired source object. Release relinquishes only this hold; it is NOT evidence of successful MediaSource.Close/SourceRetirement. Acquire receives a core.ReadRetirement context and must register any producers before starting them, including producers left behind on an error return. Acquire MUST atomically check current scope and the exact source lifetime sealing barrier while taking its hold. Prior Verify is not admission: a retirement barrier can seal between verification and acquisition. An error may return a nonempty Hold, which is retained until its tracker drains. Release must be bounded, nonblocking accounting, and must not perform I/O.
type Reader ¶
type Reader struct {
// contains filtered or unexported fields
}
Reader is safe for concurrent ReaderAt calls. Close cancels local network work. Done proves only local HTTP requests exited; neither Close nor EOF nor Done attests remote producer, source or encoder retirement. Host lifecycle must reconcile source-node holds independently, even after grant expiry.
func (*Reader) ReadAtContext ¶
func (*Reader) Renew ¶
func (r *Reader) Renew(ctx context.Context, authority func(context.Context, Grant) (Grant, error)) error
Renew obtains fresh authority rather than extending a raw deadline. Every Scope field and the HEAD representation must remain identical. Existing reads retain their old deadline. Renewal cannot revive an expired grant.