package calls
import "github.com/mesos/mesos-go/api/v1/lib/agent/calls"
Example¶
Code:
{
var (
check = func(err error) {
if err != nil {
panic(err)
}
}
swallow = func(_ mesos.Response, err error) { check(err) }
ctx = context.Background()
sender = SenderFunc(func(_ context.Context, _ Request) (_ mesos.Response, _ error) { return })
blackhole = func(calls ...*agent.Call) {
for i := range calls {
swallow(sender.Send(ctx, NonStreaming(calls[i])))
}
}
d = time.Duration(0)
)
blackhole(
GetHealth(),
GetFlags(),
GetVersion(),
GetMetrics(nil),
GetMetrics(&d),
GetLoggingLevel(),
ListFiles(""),
ReadFile("", 0),
ReadFileWithLength("", 0, 0),
GetState(),
GetContainers(),
GetFrameworks(),
GetExecutors(),
GetOperations(),
GetTasks(),
GetAgent(),
GetResourceProviders(),
WaitContainer(mesos.ContainerID{}),
WaitNestedContainer(mesos.ContainerID{}),
LaunchNestedContainerSession(mesos.ContainerID{}, nil, nil),
)
blackhole = func(calls ...*agent.Call) {
for i := range calls {
check(SendNoData(ctx, sender, NonStreaming(calls[i])))
}
}
blackhole(
SetLoggingLevel(0, d),
LaunchContainer(mesos.ContainerID{}, nil, nil, nil),
LaunchNestedContainer(mesos.ContainerID{}, nil, nil),
KillContainer(mesos.ContainerID{}),
KillNestedContainer(mesos.ContainerID{}),
RemoveContainer(mesos.ContainerID{}),
RemoveNestedContainer(mesos.ContainerID{}),
AttachContainerOutput(mesos.ContainerID{}),
AddResourceProviderConfig(mesos.ResourceProviderInfo{}),
UpdateResourceProviderConfig(mesos.ResourceProviderInfo{}),
RemoveResourceProviderConfig("", ""),
PruneImages(nil),
)
swallow(sender.Send(ctx, Empty().Push(
AttachContainerInput(mesos.ContainerID{}),
AttachContainerInputTTY(nil),
AttachContainerInputData(nil),
AttachContainerInputHeartbeat(nil),
)))
// Output:
}
Index ¶
- func AddResourceProviderConfig(rpi mesos.ResourceProviderInfo) *agent.Call
- func AttachContainerInput(cid mesos.ContainerID) *agent.Call
- func AttachContainerInputData(data []byte) *agent.Call
- func AttachContainerInputHeartbeat(heartbeat *agent.ProcessIO_Control_Heartbeat) *agent.Call
- func AttachContainerInputTTY(t *mesos.TTYInfo) *agent.Call
- func AttachContainerOutput(cid mesos.ContainerID) *agent.Call
- func GetAgent() *agent.Call
- func GetContainers() *agent.Call
- func GetExecutors() *agent.Call
- func GetFlags() *agent.Call
- func GetFrameworks() *agent.Call
- func GetHealth() *agent.Call
- func GetLoggingLevel() *agent.Call
- func GetMetrics(d *time.Duration) (call *agent.Call)
- func GetOperations() *agent.Call
- func GetResourceProviders() *agent.Call
- func GetState() *agent.Call
- func GetTasks() *agent.Call
- func GetVersion() *agent.Call
- func KillContainer(cid mesos.ContainerID) *agent.Call
- func KillNestedContainer(cid mesos.ContainerID) *agent.Call
- func LaunchContainer(cid mesos.ContainerID, cmd *mesos.CommandInfo, ci *mesos.ContainerInfo, r []mesos.Resource) *agent.Call
- func LaunchNestedContainer(cid mesos.ContainerID, cmd *mesos.CommandInfo, ci *mesos.ContainerInfo) *agent.Call
- func LaunchNestedContainerSession(cid mesos.ContainerID, cmd *mesos.CommandInfo, ci *mesos.ContainerInfo) *agent.Call
- func ListFiles(path string) *agent.Call
- func MarkResourceProviderGone(id mesos.ResourceProviderID) *agent.Call
- func PruneImages(excluded []mesos.Image) *agent.Call
- func ReadFile(path string, offset uint64) *agent.Call
- func ReadFileWithLength(path string, offset, length uint64) (call *agent.Call)
- func RemoveContainer(cid mesos.ContainerID) *agent.Call
- func RemoveNestedContainer(cid mesos.ContainerID) *agent.Call
- func RemoveResourceProviderConfig(typ, name string) *agent.Call
- func SendNoData(ctx context.Context, sender Sender, r Request) (err error)
- func SetLoggingLevel(level uint32, d time.Duration) *agent.Call
- func UpdateResourceProviderConfig(rpi mesos.ResourceProviderInfo) *agent.Call
- func WaitContainer(cid mesos.ContainerID) *agent.Call
- func WaitNestedContainer(cid mesos.ContainerID) *agent.Call
- type Request
- type RequestFunc
- func NonStreaming(c *agent.Call) RequestFunc
- func (f RequestFunc) Call() *agent.Call
- func (f RequestFunc) Marshaler() encoding.Marshaler
- type RequestStreaming
- type RequestStreamingFunc
- func Empty() RequestStreamingFunc
- func FromChan(ch <-chan *agent.Call) RequestStreamingFunc
- func Push(r RequestStreaming, c ...*agent.Call) RequestStreamingFunc
- func (f RequestStreamingFunc) Call() *agent.Call
- func (f RequestStreamingFunc) IsStreaming()
- func (f RequestStreamingFunc) Marshaler() encoding.Marshaler
- func (f RequestStreamingFunc) Push(c ...*agent.Call) RequestStreamingFunc
- type Sender
- type SenderFunc
Examples ¶
Functions ¶
func AddResourceProviderConfig ¶
func AttachContainerInput ¶
AttachContainerInput returns a Call that is used to initiate attachment to a container's stdin. Callers should first send this Call followed by one or more AttachContainerInputXxx calls.
func AttachContainerInputData ¶
func AttachContainerInputHeartbeat ¶
func AttachContainerInputHeartbeat(heartbeat *agent.ProcessIO_Control_Heartbeat) *agent.Call
func AttachContainerInputTTY ¶
func AttachContainerOutput ¶
func GetAgent ¶
func GetContainers ¶
func GetExecutors ¶
func GetFlags ¶
func GetFrameworks ¶
func GetHealth ¶
func GetLoggingLevel ¶
func GetMetrics ¶
func GetOperations ¶
func GetResourceProviders ¶
func GetState ¶
func GetTasks ¶
func GetVersion ¶
func KillContainer ¶
func KillNestedContainer ¶
func LaunchContainer ¶
func LaunchContainer(cid mesos.ContainerID, cmd *mesos.CommandInfo, ci *mesos.ContainerInfo, r []mesos.Resource) *agent.Call
func LaunchNestedContainer ¶
func LaunchNestedContainer(cid mesos.ContainerID, cmd *mesos.CommandInfo, ci *mesos.ContainerInfo) *agent.Call
func LaunchNestedContainerSession ¶
func LaunchNestedContainerSession(cid mesos.ContainerID, cmd *mesos.CommandInfo, ci *mesos.ContainerInfo) *agent.Call
func ListFiles ¶
func MarkResourceProviderGone ¶
func PruneImages ¶
func ReadFile ¶
func ReadFileWithLength ¶
func RemoveContainer ¶
func RemoveNestedContainer ¶
func RemoveResourceProviderConfig ¶
func SendNoData ¶
SendNoData is a convenience func that executes the given Call using the provided Sender and always drops the response data.
func SetLoggingLevel ¶
func UpdateResourceProviderConfig ¶
func WaitContainer ¶
func WaitNestedContainer ¶
Types ¶
type Request ¶
Request generates a Call that's sent to a Mesos agent. Subsequent invocations are expected to yield equivalent calls. Intended for use w/ non-streaming requests to an agent.
type RequestFunc ¶
RequestFunc is the functional adaptation of Request.
func NonStreaming ¶
func NonStreaming(c *agent.Call) RequestFunc
NonStreaming returns a RequestFunc that always generates the same Call.
func (RequestFunc) Call ¶
func (f RequestFunc) Call() *agent.Call
func (RequestFunc) Marshaler ¶
func (f RequestFunc) Marshaler() encoding.Marshaler
type RequestStreaming ¶
type RequestStreaming interface { Request IsStreaming() }
RequestStreaming generates a Call that's send to a Mesos agent. Subsequent invocations MAY generate different Call objects. No more Call objects are expected once a nil is returned to signal the end of of the request stream.
type RequestStreamingFunc ¶
RequestStreamingFunc is the functional adaptation of RequestStreaming.
func Empty ¶
func Empty() RequestStreamingFunc
Empty generates a stream that always returns nil.
func FromChan ¶
func FromChan(ch <-chan *agent.Call) RequestStreamingFunc
FromChan returns a streaming request that fetches calls from the given channel until it closes. If a nil chan is specified then the returned func will always generate nil.
func Push ¶
func Push(r RequestStreaming, c ...*agent.Call) RequestStreamingFunc
Push prepends one or more calls onto a request stream. If no calls are given then the original stream is returned.
func (RequestStreamingFunc) Call ¶
func (f RequestStreamingFunc) Call() *agent.Call
func (RequestStreamingFunc) IsStreaming ¶
func (f RequestStreamingFunc) IsStreaming()
func (RequestStreamingFunc) Marshaler ¶
func (f RequestStreamingFunc) Marshaler() encoding.Marshaler
func (RequestStreamingFunc) Push ¶
func (f RequestStreamingFunc) Push(c ...*agent.Call) RequestStreamingFunc
type Sender ¶
Send issues a Request to a Mesos agent and properly manages Call-specific mechanics.
type SenderFunc ¶
SenderFunc is the functional adaptation of the Sender interface
func IgnoreResponse ¶
func IgnoreResponse(s Sender) SenderFunc
IgnoreResponse generates a sender that closes any non-nil response received by Mesos.
func (SenderFunc) Send ¶
func (f SenderFunc) Send(ctx context.Context, r Request) (mesos.Response, error)
Send implements the Sender interface for SenderFunc
Source Files ¶
calls.go calls_generated.go gen.go
- Version
- v0.0.11 (latest)
- Published
- May 15, 2020
- Platform
- linux/amd64
- Imports
- 5 packages
- Last checked
- 24 seconds ago –
Tools for package owners.