Documentation
¶
Index ¶
- func CheckPayloadBinding(supplied *pb.ControlBinding, admitted controlsession.Binding) error
- type BidiClient
- func (b *BidiClient) Binding() (controlsession.Binding, bool)
- func (b *BidiClient) Cause() error
- func (b *BidiClient) CheckLease(binding controlsession.Binding) error
- func (b *BidiClient) ClientFor(binding controlsession.Binding) (pb.DispatcherServiceClient, error)
- func (b *BidiClient) Close()
- func (b *BidiClient) CommitLease(binding controlsession.Binding, commit func()) error
- func (b *BidiClient) CommitUpload(binding controlsession.Binding, commit func()) error
- func (b *BidiClient) ConnectAndServe(parent context.Context) (result error)
- func (b *BidiClient) Lost() <-chan struct{}
- func (b *BidiClient) ReflectAddress(ctx context.Context, binding controlsession.Binding, endpoint string, ...) (*pb.ReflectAddressResponse, error)
- func (b *BidiClient) ReflectAddressAs(ctx context.Context, binding controlsession.Binding, ...) (*pb.ReflectAddressResponse, error)
- func (b *BidiClient) Stop(cause error)
- func (b *BidiClient) WaitReadyContext(ctx context.Context) error
- type BidiOptions
- type ExecutorState
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func CheckPayloadBinding ¶
func CheckPayloadBinding(supplied *pb.ControlBinding, admitted controlsession.Binding) error
CheckPayloadBinding compares the immutable binding a request carries with the session that was admitted, which is the one rule for every request that names its own session. It decides nothing about possession: the transport authenticates the caller's credentials first, and the state rechecks its lease at the moment an effect commits. Callers that reach a handler directly apply it themselves, so the rule does not depend on which path a request took.
Types ¶
type BidiClient ¶
type BidiClient struct {
// contains filtered or unexported fields
}
BidiClient connects to the dispatcher and sets up a bidirectional stream allowing for the dispatcher to call the executor's gRPC server's methods.
It is the one authority over this executor's control binding: the binding is armed when Bind is sent inside the startup deadline, renewed only by an acknowledgement of this client's own renewal and counted from the moment that renewal was sent, and revoked once, keeping the cause that revoked it. Admission and each step of execution recheck that authority, and the scheduler's insert and start commits (CommitUpload, CommitLease) are guarded by it atomically, so a reply arriving after the lease ran out starts nothing. A client is bound once; direct senders use ClientFor after negotiation.
func NewBidiClient ¶
func NewBidiClient(opts BidiOptions, state ExecutorState) (*BidiClient, error)
func (*BidiClient) Binding ¶
func (b *BidiClient) Binding() (controlsession.Binding, bool)
Binding includes the live armed pre-acknowledgement Upload interval.
func (*BidiClient) Cause ¶
func (b *BidiClient) Cause() error
func (*BidiClient) CheckLease ¶
func (b *BidiClient) CheckLease(binding controlsession.Binding) error
func (*BidiClient) ClientFor ¶
func (b *BidiClient) ClientFor(binding controlsession.Binding) (pb.DispatcherServiceClient, error)
func (*BidiClient) Close ¶
func (b *BidiClient) Close()
func (*BidiClient) CommitLease ¶
func (b *BidiClient) CommitLease(binding controlsession.Binding, commit func()) error
CommitLease serializes a bounded start/admission transition with revocation. Callers may hold scheduler core first; the callback must not enter SQL, I/O, cancellation, other transport guards or any join.
func (*BidiClient) CommitUpload ¶
func (b *BidiClient) CommitUpload(binding controlsession.Binding, commit func()) error
CommitUpload also permits a live pending Bind interval. It authorizes only reserving queued persistence; it cannot authorize queue promotion or Run.
func (*BidiClient) ConnectAndServe ¶
func (b *BidiClient) ConnectAndServe(parent context.Context) (result error)
ConnectAndServe owns one invocation and all renewal, watchdog, serving and cancellation helpers. Lost is independent of the joins in its finalizer.
func (*BidiClient) Lost ¶
func (b *BidiClient) Lost() <-chan struct{}
Lost closes before teardown can block. It signals no handler or resource completion; the caller must still join ConnectAndServe and Close.
func (*BidiClient) ReflectAddress ¶ added in v0.3.0
func (b *BidiClient) ReflectAddress(ctx context.Context, binding controlsession.Binding, endpoint string, request *pb.ReflectAddressRequest) (*pb.ReflectAddressResponse, error)
ReflectAddress opens one additional direct channel to an operator-selected literal address of this dispatcher, under the existing TLS identity and control binding. No request, peer response or DNS result chooses its target.
func (*BidiClient) ReflectAddressAs ¶ added in v0.3.0
func (b *BidiClient) ReflectAddressAs(ctx context.Context, binding controlsession.Binding, endpoint, authority string, request *pb.ReflectAddressRequest) (*pb.ReflectAddressResponse, error)
ReflectAddressAs is ReflectAddress to a literal endpoint that the executor resolved from its configured dispatcher name. TLS verifies the dispatcher's certificate for authority, that name, unless tls.server_name overrides it, so a resolved address that is not this dispatcher fails the handshake. An empty authority keeps the endpoint's own.
func (*BidiClient) Stop ¶
func (b *BidiClient) Stop(cause error)
Stop revokes eligibility only. The invocation's owned watcher cancels I/O; the lifecycle owner separately signals scheduler shutdown before joining.
func (*BidiClient) WaitReadyContext ¶
func (b *BidiClient) WaitReadyContext(ctx context.Context) error
WaitReadyContext also resolves when the initial connection fails. Readiness describes completed Hello/Bind negotiation, not a Resources acknowledgement.
type BidiOptions ¶
type BidiOptions struct {
Logger *zap.Logger
Address string
YamuxAddress string
TLSCreds credentials.TransportCredentials
TLSConfig *tls.Config
// Receiver-local clock seams fixed at construction; production uses Go time.
LeaseNow func() time.Time
NewLeaseTicker func(time.Duration) (<-chan time.Time, func())
}
type ExecutorState ¶
type ExecutorState interface {
OnHello(ctx context.Context, req *pb.HelloRequest) (*pb.HelloResponse, error)
OnUpload(ctx context.Context, binding controlsession.Binding, req *pb.UploadRequest) (*pb.UploadResponse, error)
OnAbort(ctx context.Context, binding controlsession.Binding, req *pb.AbortRequest) (*pb.AbortResponse, error)
OnBandwidth(ctx context.Context, binding controlsession.Binding, req *pb.BandwidthRequest) (*pb.BandwidthResponse, error)
}
ExecutorState receives the immutable binding the reverse transport validated. An acknowledged RPC is not proof that the dispatcher finished anything.