Documentation
¶
Index ¶
- Constants
- type FakeRendezvous
- func (rdv *FakeRendezvous) DeregisterInstance(ctx context.Context, id string)
- func (rdv *FakeRendezvous) HandleReverse(w http.ResponseWriter, r *http.Request)
- func (rdv *FakeRendezvous) RegisterInstance(ctx context.Context, id string, wait time.Duration)
- func (rdv *FakeRendezvous) WaitForInstance(ctx context.Context, id string) (buildlet.Client, error)
- type Option
- type Rendezvous
- func (rdv *Rendezvous) DeregisterInstance(ctx context.Context, id string)
- func (rdv *Rendezvous) HandleReverse(w http.ResponseWriter, r *http.Request)
- func (rdv *Rendezvous) RegisterInstance(ctx context.Context, id string, wait time.Duration)
- func (rdv *Rendezvous) WaitForInstance(ctx context.Context, id string) (buildlet.Client, error)
- type TokenValidator
Constants ¶
const ( // HeaderID is the HTTP header used for passing the gomote ID. HeaderID = "X-Go-Gomote-ID" // HeaderToken is the HTTP header used for passing in the authentication token. HeaderToken = "X-Go-Swarming-Auth-Token" // HeaderHostname is the HTTP header used for passing in the hostname. HeaderHostname = "X-Go-Hostname" )
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type FakeRendezvous ¶
type FakeRendezvous struct {
// contains filtered or unexported fields
}
FakeRendezvous is a fake rendezvous implementation intended for use in testing.
func NewFake ¶
func NewFake(ctx context.Context, validator TokenValidator) *FakeRendezvous
NewFake creates a Fake Rendezvous instance.
func (*FakeRendezvous) DeregisterInstance ¶
func (rdv *FakeRendezvous) DeregisterInstance(ctx context.Context, id string)
DeregisterInstance is a fake implementation.
func (*FakeRendezvous) HandleReverse ¶
func (rdv *FakeRendezvous) HandleReverse(w http.ResponseWriter, r *http.Request)
HandleReverse is a fake implementation of the handler.
func (*FakeRendezvous) RegisterInstance ¶
RegisterInstance is a fake implementation.
func (*FakeRendezvous) WaitForInstance ¶
WaitForInstance is a fake implementation.
type Option ¶
type Option func(*Rendezvous)
Option is an optional configuration setting.
func OptionValidator ¶
func OptionValidator(v TokenValidator) Option
OptionValidator changes the verifier used by Rendezvous.
type Rendezvous ¶
type Rendezvous struct {
// contains filtered or unexported fields
}
Rendezvous waits for buildlets to connect, verifies they are valid instances and passes the connection to the waiting caller.
func New ¶
func New(ctx context.Context, opts ...Option) *Rendezvous
New creates a Rendezvous element. The context that is passed in should be non-canceled during the lifetime of the running service.
func (*Rendezvous) DeregisterInstance ¶
func (rdv *Rendezvous) DeregisterInstance(ctx context.Context, id string)
DeregisterInstance removes the registration for an instance which has been previously registered.
func (*Rendezvous) HandleReverse ¶
func (rdv *Rendezvous) HandleReverse(w http.ResponseWriter, r *http.Request)
HandleReverse handles HTTP requests from the buildlet and passes the connection to the waiter.
func (*Rendezvous) RegisterInstance ¶
RegisterInstance notes an instance and waits for that instance to connect to the handler. An instance must be registered before the instance can attempt to connect. If an instance does not connect before the end of the wait period, the instance will not be able to connect.
func (*Rendezvous) WaitForInstance ¶
WaitForInstance waits for the registered instance to successfully connect. It waits for the lifetime of the context. If the instance is not registered or has exceeded the timeout period, it will immediately return an error.