diff --git a/api/api.pb.go b/api/api.pb.go new file mode 100644 index 0000000000..cbf6c4a735 --- /dev/null +++ b/api/api.pb.go @@ -0,0 +1,1403 @@ +// Code generated by protoc-gen-go. +// source: api.proto +// DO NOT EDIT! + +/* +Package api is a generated protocol buffer package. + +It is generated from these files: + api.proto + +It has these top-level messages: + Node + Spec + TaskStatus + Task + Job + Update + RegisterNodeRequest + RegisterNodeResponse + UpdateNodeStatusRequest + UpdateNodeStatusResponse + ListNodesRequest + ListNodesResponse + DrainNodeRequest + DrainNodeResponse + CreateTaskRequest + CreateTaskResponse + GetTasksRequest + GetTasksResponse + RemoveTaskRequest + RemoveTaskResponse + ListTasksRequest + ListTasksResponse + CreateJobRequest + CreateJobResponse + GetJobRequest + GetJobResponse + UpdateJobRequest + UpdateJobResponse + RemoveJobRequest + RemoveJobResponse + ListJobsRequest + ListJobsResponse + UpdateTaskStatusRequest + UpdateTaskStatusResponse + WatchTasksRequest + WatchTasksResponse +*/ +package api + +import proto "github.com/golang/protobuf/proto" +import fmt "fmt" +import math "math" + +import ( + context "golang.org/x/net/context" + grpc "google.golang.org/grpc" +) + +// Reference imports to suppress errors if they are not otherwise used. +var _ = proto.Marshal +var _ = fmt.Errorf +var _ = math.Inf + +// This is a compile-time assertion to ensure that this generated file +// is compatible with the proto package it is being compiled against. +const _ = proto.ProtoPackageIsVersion1 + +type NodeStatus int32 + +const ( + NodeStatus_READY NodeStatus = 0 + NodeStatus_DOWN NodeStatus = 1 +) + +var NodeStatus_name = map[int32]string{ + 0: "READY", + 1: "DOWN", +} +var NodeStatus_value = map[string]int32{ + "READY": 0, + "DOWN": 1, +} + +func (x NodeStatus) String() string { + return proto.EnumName(NodeStatus_name, int32(x)) +} +func (NodeStatus) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +type TaskStatus_State int32 + +const ( + TaskStatus_NEW TaskStatus_State = 0 + TaskStatus_ASSIGNED TaskStatus_State = 1 + TaskStatus_PREPARING TaskStatus_State = 2 + TaskStatus_READY TaskStatus_State = 3 + TaskStatus_STARTING TaskStatus_State = 4 + TaskStatus_RUNNING TaskStatus_State = 5 + TaskStatus_SHUTDOWN TaskStatus_State = 6 + TaskStatus_COMPLETE TaskStatus_State = 7 + TaskStatus_FAILED TaskStatus_State = 8 + TaskStatus_REJECTED TaskStatus_State = 9 + TaskStatus_FINALIZE TaskStatus_State = 10 + TaskStatus_DEAD TaskStatus_State = 11 +) + +var TaskStatus_State_name = map[int32]string{ + 0: "NEW", + 1: "ASSIGNED", + 2: "PREPARING", + 3: "READY", + 4: "STARTING", + 5: "RUNNING", + 6: "SHUTDOWN", + 7: "COMPLETE", + 8: "FAILED", + 9: "REJECTED", + 10: "FINALIZE", + 11: "DEAD", +} +var TaskStatus_State_value = map[string]int32{ + "NEW": 0, + "ASSIGNED": 1, + "PREPARING": 2, + "READY": 3, + "STARTING": 4, + "RUNNING": 5, + "SHUTDOWN": 6, + "COMPLETE": 7, + "FAILED": 8, + "REJECTED": 9, + "FINALIZE": 10, + "DEAD": 11, +} + +func (x TaskStatus_State) String() string { + return proto.EnumName(TaskStatus_State_name, int32(x)) +} +func (TaskStatus_State) EnumDescriptor() ([]byte, []int) { return fileDescriptor0, []int{2, 0} } + +type Node struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Name string `protobuf:"bytes,2,opt,name=name" json:"name,omitempty"` + Ip string `protobuf:"bytes,4,opt,name=ip" json:"ip,omitempty"` + Drained bool `protobuf:"varint,5,opt,name=drained" json:"drained,omitempty"` + Status NodeStatus `protobuf:"varint,3,opt,name=status,enum=api.NodeStatus" json:"status,omitempty"` +} + +func (m *Node) Reset() { *m = Node{} } +func (m *Node) String() string { return proto.CompactTextString(m) } +func (*Node) ProtoMessage() {} +func (*Node) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{0} } + +// Spec defines the properties of a Job. As tasks are created, they gain the +// Job specification. +type Spec struct { + Name string `protobuf:"bytes,1,opt,name=name" json:"name,omitempty"` + // remote specifies a URL to fetch task bundle data. This can either + // be a git repository or blobster repository. + Remote string `protobuf:"bytes,2,opt,name=remote" json:"remote,omitempty"` + Bundle string `protobuf:"bytes,3,opt,name=bundle" json:"bundle,omitempty"` + Entrypoint string `protobuf:"bytes,4,opt,name=entrypoint" json:"entrypoint,omitempty"` + Instances int64 `protobuf:"varint,5,opt,name=instances" json:"instances,omitempty"` +} + +func (m *Spec) Reset() { *m = Spec{} } +func (m *Spec) String() string { return proto.CompactTextString(m) } +func (*Spec) ProtoMessage() {} +func (*Spec) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{1} } + +type TaskStatus struct { + State TaskStatus_State `protobuf:"varint,2,opt,name=state,enum=api.TaskStatus_State" json:"state,omitempty"` + Message string `protobuf:"bytes,3,opt,name=message" json:"message,omitempty"` +} + +func (m *TaskStatus) Reset() { *m = TaskStatus{} } +func (m *TaskStatus) String() string { return proto.CompactTextString(m) } +func (*TaskStatus) ProtoMessage() {} +func (*TaskStatus) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{2} } + +type Task struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + JobId string `protobuf:"bytes,2,opt,name=job_id" json:"job_id,omitempty"` + NodeId string `protobuf:"bytes,3,opt,name=node_id" json:"node_id,omitempty"` + Spec *Spec `protobuf:"bytes,4,opt,name=spec" json:"spec,omitempty"` + Status *TaskStatus `protobuf:"bytes,5,opt,name=status" json:"status,omitempty"` + // Networking state + NetId string `protobuf:"bytes,6,opt,name=net_id" json:"net_id,omitempty"` + EpId string `protobuf:"bytes,7,opt,name=ep_id" json:"ep_id,omitempty"` + Ip string `protobuf:"bytes,8,opt,name=ip" json:"ip,omitempty"` + Gateway string `protobuf:"bytes,9,opt,name=gateway" json:"gateway,omitempty"` + DriverInfo []string `protobuf:"bytes,10,rep,name=driver_info" json:"driver_info,omitempty"` +} + +func (m *Task) Reset() { *m = Task{} } +func (m *Task) String() string { return proto.CompactTextString(m) } +func (*Task) ProtoMessage() {} +func (*Task) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{3} } + +func (m *Task) GetSpec() *Spec { + if m != nil { + return m.Spec + } + return nil +} + +func (m *Task) GetStatus() *TaskStatus { + if m != nil { + return m.Status + } + return nil +} + +type Job struct { + Id string `protobuf:"bytes,1,opt,name=id" json:"id,omitempty"` + Spec *Spec `protobuf:"bytes,2,opt,name=spec" json:"spec,omitempty"` +} + +func (m *Job) Reset() { *m = Job{} } +func (m *Job) String() string { return proto.CompactTextString(m) } +func (*Job) ProtoMessage() {} +func (*Job) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{4} } + +func (m *Job) GetSpec() *Spec { + if m != nil { + return m.Spec + } + return nil +} + +type Update struct { + // Types that are valid to be assigned to Update: + // *Update_UpdateNode + // *Update_UpdateTask + // *Update_UpdateJob + // *Update_DeleteNode + // *Update_DeleteTask + // *Update_DeleteJob + Update isUpdate_Update `protobuf_oneof:"update"` +} + +func (m *Update) Reset() { *m = Update{} } +func (m *Update) String() string { return proto.CompactTextString(m) } +func (*Update) ProtoMessage() {} +func (*Update) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{5} } + +type isUpdate_Update interface { + isUpdate_Update() +} + +type Update_UpdateNode struct { + UpdateNode *Node `protobuf:"bytes,1,opt,name=updateNode,oneof"` +} +type Update_UpdateTask struct { + UpdateTask *Task `protobuf:"bytes,2,opt,name=updateTask,oneof"` +} +type Update_UpdateJob struct { + UpdateJob *Job `protobuf:"bytes,4,opt,name=updateJob,oneof"` +} +type Update_DeleteNode struct { + DeleteNode string `protobuf:"bytes,5,opt,name=deleteNode,oneof"` +} +type Update_DeleteTask struct { + DeleteTask string `protobuf:"bytes,6,opt,name=deleteTask,oneof"` +} +type Update_DeleteJob struct { + DeleteJob string `protobuf:"bytes,8,opt,name=deleteJob,oneof"` +} + +func (*Update_UpdateNode) isUpdate_Update() {} +func (*Update_UpdateTask) isUpdate_Update() {} +func (*Update_UpdateJob) isUpdate_Update() {} +func (*Update_DeleteNode) isUpdate_Update() {} +func (*Update_DeleteTask) isUpdate_Update() {} +func (*Update_DeleteJob) isUpdate_Update() {} + +func (m *Update) GetUpdate() isUpdate_Update { + if m != nil { + return m.Update + } + return nil +} + +func (m *Update) GetUpdateNode() *Node { + if x, ok := m.GetUpdate().(*Update_UpdateNode); ok { + return x.UpdateNode + } + return nil +} + +func (m *Update) GetUpdateTask() *Task { + if x, ok := m.GetUpdate().(*Update_UpdateTask); ok { + return x.UpdateTask + } + return nil +} + +func (m *Update) GetUpdateJob() *Job { + if x, ok := m.GetUpdate().(*Update_UpdateJob); ok { + return x.UpdateJob + } + return nil +} + +func (m *Update) GetDeleteNode() string { + if x, ok := m.GetUpdate().(*Update_DeleteNode); ok { + return x.DeleteNode + } + return "" +} + +func (m *Update) GetDeleteTask() string { + if x, ok := m.GetUpdate().(*Update_DeleteTask); ok { + return x.DeleteTask + } + return "" +} + +func (m *Update) GetDeleteJob() string { + if x, ok := m.GetUpdate().(*Update_DeleteJob); ok { + return x.DeleteJob + } + return "" +} + +// XXX_OneofFuncs is for the internal use of the proto package. +func (*Update) XXX_OneofFuncs() (func(msg proto.Message, b *proto.Buffer) error, func(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error), func(msg proto.Message) (n int), []interface{}) { + return _Update_OneofMarshaler, _Update_OneofUnmarshaler, _Update_OneofSizer, []interface{}{ + (*Update_UpdateNode)(nil), + (*Update_UpdateTask)(nil), + (*Update_UpdateJob)(nil), + (*Update_DeleteNode)(nil), + (*Update_DeleteTask)(nil), + (*Update_DeleteJob)(nil), + } +} + +func _Update_OneofMarshaler(msg proto.Message, b *proto.Buffer) error { + m := msg.(*Update) + // update + switch x := m.Update.(type) { + case *Update_UpdateNode: + b.EncodeVarint(1<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.UpdateNode); err != nil { + return err + } + case *Update_UpdateTask: + b.EncodeVarint(2<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.UpdateTask); err != nil { + return err + } + case *Update_UpdateJob: + b.EncodeVarint(4<<3 | proto.WireBytes) + if err := b.EncodeMessage(x.UpdateJob); err != nil { + return err + } + case *Update_DeleteNode: + b.EncodeVarint(5<<3 | proto.WireBytes) + b.EncodeStringBytes(x.DeleteNode) + case *Update_DeleteTask: + b.EncodeVarint(6<<3 | proto.WireBytes) + b.EncodeStringBytes(x.DeleteTask) + case *Update_DeleteJob: + b.EncodeVarint(8<<3 | proto.WireBytes) + b.EncodeStringBytes(x.DeleteJob) + case nil: + default: + return fmt.Errorf("Update.Update has unexpected type %T", x) + } + return nil +} + +func _Update_OneofUnmarshaler(msg proto.Message, tag, wire int, b *proto.Buffer) (bool, error) { + m := msg.(*Update) + switch tag { + case 1: // update.updateNode + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Node) + err := b.DecodeMessage(msg) + m.Update = &Update_UpdateNode{msg} + return true, err + case 2: // update.updateTask + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Task) + err := b.DecodeMessage(msg) + m.Update = &Update_UpdateTask{msg} + return true, err + case 4: // update.updateJob + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + msg := new(Job) + err := b.DecodeMessage(msg) + m.Update = &Update_UpdateJob{msg} + return true, err + case 5: // update.deleteNode + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Update = &Update_DeleteNode{x} + return true, err + case 6: // update.deleteTask + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Update = &Update_DeleteTask{x} + return true, err + case 8: // update.deleteJob + if wire != proto.WireBytes { + return true, proto.ErrInternalBadWireType + } + x, err := b.DecodeStringBytes() + m.Update = &Update_DeleteJob{x} + return true, err + default: + return false, nil + } +} + +func _Update_OneofSizer(msg proto.Message) (n int) { + m := msg.(*Update) + // update + switch x := m.Update.(type) { + case *Update_UpdateNode: + s := proto.Size(x.UpdateNode) + n += proto.SizeVarint(1<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *Update_UpdateTask: + s := proto.Size(x.UpdateTask) + n += proto.SizeVarint(2<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *Update_UpdateJob: + s := proto.Size(x.UpdateJob) + n += proto.SizeVarint(4<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(s)) + n += s + case *Update_DeleteNode: + n += proto.SizeVarint(5<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.DeleteNode))) + n += len(x.DeleteNode) + case *Update_DeleteTask: + n += proto.SizeVarint(6<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.DeleteTask))) + n += len(x.DeleteTask) + case *Update_DeleteJob: + n += proto.SizeVarint(8<<3 | proto.WireBytes) + n += proto.SizeVarint(uint64(len(x.DeleteJob))) + n += len(x.DeleteJob) + case nil: + default: + panic(fmt.Sprintf("proto: unexpected type %T in oneof", x)) + } + return n +} + +type RegisterNodeRequest struct { + Node *Node `protobuf:"bytes,1,opt,name=node" json:"node,omitempty"` +} + +func (m *RegisterNodeRequest) Reset() { *m = RegisterNodeRequest{} } +func (m *RegisterNodeRequest) String() string { return proto.CompactTextString(m) } +func (*RegisterNodeRequest) ProtoMessage() {} +func (*RegisterNodeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{6} } + +func (m *RegisterNodeRequest) GetNode() *Node { + if m != nil { + return m.Node + } + return nil +} + +type RegisterNodeResponse struct { + HeartbeatTtl uint64 `protobuf:"varint,1,opt,name=heartbeat_ttl" json:"heartbeat_ttl,omitempty"` +} + +func (m *RegisterNodeResponse) Reset() { *m = RegisterNodeResponse{} } +func (m *RegisterNodeResponse) String() string { return proto.CompactTextString(m) } +func (*RegisterNodeResponse) ProtoMessage() {} +func (*RegisterNodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{7} } + +type UpdateNodeStatusRequest struct { + NodeId string `protobuf:"bytes,1,opt,name=node_id" json:"node_id,omitempty"` + Status NodeStatus `protobuf:"varint,2,opt,name=status,enum=api.NodeStatus" json:"status,omitempty"` +} + +func (m *UpdateNodeStatusRequest) Reset() { *m = UpdateNodeStatusRequest{} } +func (m *UpdateNodeStatusRequest) String() string { return proto.CompactTextString(m) } +func (*UpdateNodeStatusRequest) ProtoMessage() {} +func (*UpdateNodeStatusRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{8} } + +type UpdateNodeStatusResponse struct { + HeartbeatTtl uint64 `protobuf:"varint,1,opt,name=heartbeat_ttl" json:"heartbeat_ttl,omitempty"` +} + +func (m *UpdateNodeStatusResponse) Reset() { *m = UpdateNodeStatusResponse{} } +func (m *UpdateNodeStatusResponse) String() string { return proto.CompactTextString(m) } +func (*UpdateNodeStatusResponse) ProtoMessage() {} +func (*UpdateNodeStatusResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{9} } + +type ListNodesRequest struct { +} + +func (m *ListNodesRequest) Reset() { *m = ListNodesRequest{} } +func (m *ListNodesRequest) String() string { return proto.CompactTextString(m) } +func (*ListNodesRequest) ProtoMessage() {} +func (*ListNodesRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{10} } + +type ListNodesResponse struct { + Nodes []*Node `protobuf:"bytes,1,rep,name=nodes" json:"nodes,omitempty"` +} + +func (m *ListNodesResponse) Reset() { *m = ListNodesResponse{} } +func (m *ListNodesResponse) String() string { return proto.CompactTextString(m) } +func (*ListNodesResponse) ProtoMessage() {} +func (*ListNodesResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{11} } + +func (m *ListNodesResponse) GetNodes() []*Node { + if m != nil { + return m.Nodes + } + return nil +} + +type DrainNodeRequest struct { + NodeId string `protobuf:"bytes,1,opt,name=node_id" json:"node_id,omitempty"` + Drain bool `protobuf:"varint,2,opt,name=drain" json:"drain,omitempty"` +} + +func (m *DrainNodeRequest) Reset() { *m = DrainNodeRequest{} } +func (m *DrainNodeRequest) String() string { return proto.CompactTextString(m) } +func (*DrainNodeRequest) ProtoMessage() {} +func (*DrainNodeRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{12} } + +type DrainNodeResponse struct { +} + +func (m *DrainNodeResponse) Reset() { *m = DrainNodeResponse{} } +func (m *DrainNodeResponse) String() string { return proto.CompactTextString(m) } +func (*DrainNodeResponse) ProtoMessage() {} +func (*DrainNodeResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{13} } + +type CreateTaskRequest struct { + Spec *Spec `protobuf:"bytes,1,opt,name=spec" json:"spec,omitempty"` +} + +func (m *CreateTaskRequest) Reset() { *m = CreateTaskRequest{} } +func (m *CreateTaskRequest) String() string { return proto.CompactTextString(m) } +func (*CreateTaskRequest) ProtoMessage() {} +func (*CreateTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{14} } + +func (m *CreateTaskRequest) GetSpec() *Spec { + if m != nil { + return m.Spec + } + return nil +} + +type CreateTaskResponse struct { + TaskId string `protobuf:"bytes,1,opt,name=task_id" json:"task_id,omitempty"` +} + +func (m *CreateTaskResponse) Reset() { *m = CreateTaskResponse{} } +func (m *CreateTaskResponse) String() string { return proto.CompactTextString(m) } +func (*CreateTaskResponse) ProtoMessage() {} +func (*CreateTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{15} } + +type GetTasksRequest struct { + TaskIds []string `protobuf:"bytes,1,rep,name=task_ids" json:"task_ids,omitempty"` +} + +func (m *GetTasksRequest) Reset() { *m = GetTasksRequest{} } +func (m *GetTasksRequest) String() string { return proto.CompactTextString(m) } +func (*GetTasksRequest) ProtoMessage() {} +func (*GetTasksRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{16} } + +type GetTasksResponse struct { + Tasks []*Task `protobuf:"bytes,1,rep,name=tasks" json:"tasks,omitempty"` +} + +func (m *GetTasksResponse) Reset() { *m = GetTasksResponse{} } +func (m *GetTasksResponse) String() string { return proto.CompactTextString(m) } +func (*GetTasksResponse) ProtoMessage() {} +func (*GetTasksResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{17} } + +func (m *GetTasksResponse) GetTasks() []*Task { + if m != nil { + return m.Tasks + } + return nil +} + +type RemoveTaskRequest struct { + TaskId string `protobuf:"bytes,1,opt,name=task_id" json:"task_id,omitempty"` +} + +func (m *RemoveTaskRequest) Reset() { *m = RemoveTaskRequest{} } +func (m *RemoveTaskRequest) String() string { return proto.CompactTextString(m) } +func (*RemoveTaskRequest) ProtoMessage() {} +func (*RemoveTaskRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{18} } + +type RemoveTaskResponse struct { +} + +func (m *RemoveTaskResponse) Reset() { *m = RemoveTaskResponse{} } +func (m *RemoveTaskResponse) String() string { return proto.CompactTextString(m) } +func (*RemoveTaskResponse) ProtoMessage() {} +func (*RemoveTaskResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{19} } + +type ListTasksRequest struct { +} + +func (m *ListTasksRequest) Reset() { *m = ListTasksRequest{} } +func (m *ListTasksRequest) String() string { return proto.CompactTextString(m) } +func (*ListTasksRequest) ProtoMessage() {} +func (*ListTasksRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{20} } + +type ListTasksResponse struct { + Tasks []*Task `protobuf:"bytes,1,rep,name=tasks" json:"tasks,omitempty"` +} + +func (m *ListTasksResponse) Reset() { *m = ListTasksResponse{} } +func (m *ListTasksResponse) String() string { return proto.CompactTextString(m) } +func (*ListTasksResponse) ProtoMessage() {} +func (*ListTasksResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{21} } + +func (m *ListTasksResponse) GetTasks() []*Task { + if m != nil { + return m.Tasks + } + return nil +} + +type CreateJobRequest struct { + Spec *Spec `protobuf:"bytes,1,opt,name=spec" json:"spec,omitempty"` +} + +func (m *CreateJobRequest) Reset() { *m = CreateJobRequest{} } +func (m *CreateJobRequest) String() string { return proto.CompactTextString(m) } +func (*CreateJobRequest) ProtoMessage() {} +func (*CreateJobRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{22} } + +func (m *CreateJobRequest) GetSpec() *Spec { + if m != nil { + return m.Spec + } + return nil +} + +type CreateJobResponse struct { + JobId string `protobuf:"bytes,1,opt,name=job_id" json:"job_id,omitempty"` +} + +func (m *CreateJobResponse) Reset() { *m = CreateJobResponse{} } +func (m *CreateJobResponse) String() string { return proto.CompactTextString(m) } +func (*CreateJobResponse) ProtoMessage() {} +func (*CreateJobResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{23} } + +type GetJobRequest struct { + JobId string `protobuf:"bytes,1,opt,name=job_id" json:"job_id,omitempty"` +} + +func (m *GetJobRequest) Reset() { *m = GetJobRequest{} } +func (m *GetJobRequest) String() string { return proto.CompactTextString(m) } +func (*GetJobRequest) ProtoMessage() {} +func (*GetJobRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{24} } + +type GetJobResponse struct { + Job *Job `protobuf:"bytes,1,opt,name=job" json:"job,omitempty"` +} + +func (m *GetJobResponse) Reset() { *m = GetJobResponse{} } +func (m *GetJobResponse) String() string { return proto.CompactTextString(m) } +func (*GetJobResponse) ProtoMessage() {} +func (*GetJobResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{25} } + +func (m *GetJobResponse) GetJob() *Job { + if m != nil { + return m.Job + } + return nil +} + +type UpdateJobRequest struct { + JobId string `protobuf:"bytes,1,opt,name=job_id" json:"job_id,omitempty"` + Spec *Spec `protobuf:"bytes,2,opt,name=spec" json:"spec,omitempty"` +} + +func (m *UpdateJobRequest) Reset() { *m = UpdateJobRequest{} } +func (m *UpdateJobRequest) String() string { return proto.CompactTextString(m) } +func (*UpdateJobRequest) ProtoMessage() {} +func (*UpdateJobRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{26} } + +func (m *UpdateJobRequest) GetSpec() *Spec { + if m != nil { + return m.Spec + } + return nil +} + +type UpdateJobResponse struct { +} + +func (m *UpdateJobResponse) Reset() { *m = UpdateJobResponse{} } +func (m *UpdateJobResponse) String() string { return proto.CompactTextString(m) } +func (*UpdateJobResponse) ProtoMessage() {} +func (*UpdateJobResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{27} } + +type RemoveJobRequest struct { + JobId string `protobuf:"bytes,1,opt,name=job_id" json:"job_id,omitempty"` +} + +func (m *RemoveJobRequest) Reset() { *m = RemoveJobRequest{} } +func (m *RemoveJobRequest) String() string { return proto.CompactTextString(m) } +func (*RemoveJobRequest) ProtoMessage() {} +func (*RemoveJobRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{28} } + +type RemoveJobResponse struct { +} + +func (m *RemoveJobResponse) Reset() { *m = RemoveJobResponse{} } +func (m *RemoveJobResponse) String() string { return proto.CompactTextString(m) } +func (*RemoveJobResponse) ProtoMessage() {} +func (*RemoveJobResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{29} } + +type ListJobsRequest struct { +} + +func (m *ListJobsRequest) Reset() { *m = ListJobsRequest{} } +func (m *ListJobsRequest) String() string { return proto.CompactTextString(m) } +func (*ListJobsRequest) ProtoMessage() {} +func (*ListJobsRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{30} } + +type ListJobsResponse struct { + Jobs []*Job `protobuf:"bytes,1,rep,name=jobs" json:"jobs,omitempty"` +} + +func (m *ListJobsResponse) Reset() { *m = ListJobsResponse{} } +func (m *ListJobsResponse) String() string { return proto.CompactTextString(m) } +func (*ListJobsResponse) ProtoMessage() {} +func (*ListJobsResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{31} } + +func (m *ListJobsResponse) GetJobs() []*Job { + if m != nil { + return m.Jobs + } + return nil +} + +type UpdateTaskStatusRequest struct { + // Tasks should contain all statuses for running tasks. Only the status + // field must be set. The spec is not required. + Tasks []*Task `protobuf:"bytes,1,rep,name=tasks" json:"tasks,omitempty"` +} + +func (m *UpdateTaskStatusRequest) Reset() { *m = UpdateTaskStatusRequest{} } +func (m *UpdateTaskStatusRequest) String() string { return proto.CompactTextString(m) } +func (*UpdateTaskStatusRequest) ProtoMessage() {} +func (*UpdateTaskStatusRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{32} } + +func (m *UpdateTaskStatusRequest) GetTasks() []*Task { + if m != nil { + return m.Tasks + } + return nil +} + +type UpdateTaskStatusResponse struct { +} + +func (m *UpdateTaskStatusResponse) Reset() { *m = UpdateTaskStatusResponse{} } +func (m *UpdateTaskStatusResponse) String() string { return proto.CompactTextString(m) } +func (*UpdateTaskStatusResponse) ProtoMessage() {} +func (*UpdateTaskStatusResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{33} } + +type WatchTasksRequest struct { + NodeId string `protobuf:"bytes,1,opt,name=node_id" json:"node_id,omitempty"` +} + +func (m *WatchTasksRequest) Reset() { *m = WatchTasksRequest{} } +func (m *WatchTasksRequest) String() string { return proto.CompactTextString(m) } +func (*WatchTasksRequest) ProtoMessage() {} +func (*WatchTasksRequest) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{34} } + +type WatchTasksResponse struct { + // Tasks is the set of tasks that should be running on the node. + // Tasks outside of this set running on the node should be terminated. + Tasks []*Task `protobuf:"bytes,1,rep,name=tasks" json:"tasks,omitempty"` +} + +func (m *WatchTasksResponse) Reset() { *m = WatchTasksResponse{} } +func (m *WatchTasksResponse) String() string { return proto.CompactTextString(m) } +func (*WatchTasksResponse) ProtoMessage() {} +func (*WatchTasksResponse) Descriptor() ([]byte, []int) { return fileDescriptor0, []int{35} } + +func (m *WatchTasksResponse) GetTasks() []*Task { + if m != nil { + return m.Tasks + } + return nil +} + +func init() { + proto.RegisterType((*Node)(nil), "api.Node") + proto.RegisterType((*Spec)(nil), "api.Spec") + proto.RegisterType((*TaskStatus)(nil), "api.TaskStatus") + proto.RegisterType((*Task)(nil), "api.Task") + proto.RegisterType((*Job)(nil), "api.Job") + proto.RegisterType((*Update)(nil), "api.Update") + proto.RegisterType((*RegisterNodeRequest)(nil), "api.RegisterNodeRequest") + proto.RegisterType((*RegisterNodeResponse)(nil), "api.RegisterNodeResponse") + proto.RegisterType((*UpdateNodeStatusRequest)(nil), "api.UpdateNodeStatusRequest") + proto.RegisterType((*UpdateNodeStatusResponse)(nil), "api.UpdateNodeStatusResponse") + proto.RegisterType((*ListNodesRequest)(nil), "api.ListNodesRequest") + proto.RegisterType((*ListNodesResponse)(nil), "api.ListNodesResponse") + proto.RegisterType((*DrainNodeRequest)(nil), "api.DrainNodeRequest") + proto.RegisterType((*DrainNodeResponse)(nil), "api.DrainNodeResponse") + proto.RegisterType((*CreateTaskRequest)(nil), "api.CreateTaskRequest") + proto.RegisterType((*CreateTaskResponse)(nil), "api.CreateTaskResponse") + proto.RegisterType((*GetTasksRequest)(nil), "api.GetTasksRequest") + proto.RegisterType((*GetTasksResponse)(nil), "api.GetTasksResponse") + proto.RegisterType((*RemoveTaskRequest)(nil), "api.RemoveTaskRequest") + proto.RegisterType((*RemoveTaskResponse)(nil), "api.RemoveTaskResponse") + proto.RegisterType((*ListTasksRequest)(nil), "api.ListTasksRequest") + proto.RegisterType((*ListTasksResponse)(nil), "api.ListTasksResponse") + proto.RegisterType((*CreateJobRequest)(nil), "api.CreateJobRequest") + proto.RegisterType((*CreateJobResponse)(nil), "api.CreateJobResponse") + proto.RegisterType((*GetJobRequest)(nil), "api.GetJobRequest") + proto.RegisterType((*GetJobResponse)(nil), "api.GetJobResponse") + proto.RegisterType((*UpdateJobRequest)(nil), "api.UpdateJobRequest") + proto.RegisterType((*UpdateJobResponse)(nil), "api.UpdateJobResponse") + proto.RegisterType((*RemoveJobRequest)(nil), "api.RemoveJobRequest") + proto.RegisterType((*RemoveJobResponse)(nil), "api.RemoveJobResponse") + proto.RegisterType((*ListJobsRequest)(nil), "api.ListJobsRequest") + proto.RegisterType((*ListJobsResponse)(nil), "api.ListJobsResponse") + proto.RegisterType((*UpdateTaskStatusRequest)(nil), "api.UpdateTaskStatusRequest") + proto.RegisterType((*UpdateTaskStatusResponse)(nil), "api.UpdateTaskStatusResponse") + proto.RegisterType((*WatchTasksRequest)(nil), "api.WatchTasksRequest") + proto.RegisterType((*WatchTasksResponse)(nil), "api.WatchTasksResponse") + proto.RegisterEnum("api.NodeStatus", NodeStatus_name, NodeStatus_value) + proto.RegisterEnum("api.TaskStatus_State", TaskStatus_State_name, TaskStatus_State_value) +} + +// Reference imports to suppress errors if they are not otherwise used. +var _ context.Context +var _ grpc.ClientConn + +// Client API for Swarm service + +type SwarmClient interface { + RegisterNode(ctx context.Context, in *RegisterNodeRequest, opts ...grpc.CallOption) (*RegisterNodeResponse, error) + UpdateNodeStatus(ctx context.Context, in *UpdateNodeStatusRequest, opts ...grpc.CallOption) (*UpdateNodeStatusResponse, error) + ListNodes(ctx context.Context, in *ListNodesRequest, opts ...grpc.CallOption) (*ListNodesResponse, error) + DrainNode(ctx context.Context, in *DrainNodeRequest, opts ...grpc.CallOption) (*DrainNodeResponse, error) + CreateTask(ctx context.Context, in *CreateTaskRequest, opts ...grpc.CallOption) (*CreateTaskResponse, error) + GetTasks(ctx context.Context, in *GetTasksRequest, opts ...grpc.CallOption) (*GetTasksResponse, error) + RemoveTask(ctx context.Context, in *RemoveTaskRequest, opts ...grpc.CallOption) (*RemoveTaskResponse, error) + ListTasks(ctx context.Context, in *ListTasksRequest, opts ...grpc.CallOption) (*ListTasksResponse, error) + CreateJob(ctx context.Context, in *CreateJobRequest, opts ...grpc.CallOption) (*CreateJobResponse, error) + GetJob(ctx context.Context, in *GetJobRequest, opts ...grpc.CallOption) (*GetJobResponse, error) + UpdateJob(ctx context.Context, in *UpdateJobRequest, opts ...grpc.CallOption) (*UpdateJobResponse, error) + RemoveJob(ctx context.Context, in *RemoveJobRequest, opts ...grpc.CallOption) (*RemoveJobResponse, error) + ListJobs(ctx context.Context, in *ListJobsRequest, opts ...grpc.CallOption) (*ListJobsResponse, error) + UpdateTaskStatus(ctx context.Context, in *UpdateTaskStatusRequest, opts ...grpc.CallOption) (*UpdateTaskStatusResponse, error) + WatchTasks(ctx context.Context, in *WatchTasksRequest, opts ...grpc.CallOption) (Swarm_WatchTasksClient, error) +} + +type swarmClient struct { + cc *grpc.ClientConn +} + +func NewSwarmClient(cc *grpc.ClientConn) SwarmClient { + return &swarmClient{cc} +} + +func (c *swarmClient) RegisterNode(ctx context.Context, in *RegisterNodeRequest, opts ...grpc.CallOption) (*RegisterNodeResponse, error) { + out := new(RegisterNodeResponse) + err := grpc.Invoke(ctx, "/api.Swarm/RegisterNode", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) UpdateNodeStatus(ctx context.Context, in *UpdateNodeStatusRequest, opts ...grpc.CallOption) (*UpdateNodeStatusResponse, error) { + out := new(UpdateNodeStatusResponse) + err := grpc.Invoke(ctx, "/api.Swarm/UpdateNodeStatus", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) ListNodes(ctx context.Context, in *ListNodesRequest, opts ...grpc.CallOption) (*ListNodesResponse, error) { + out := new(ListNodesResponse) + err := grpc.Invoke(ctx, "/api.Swarm/ListNodes", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) DrainNode(ctx context.Context, in *DrainNodeRequest, opts ...grpc.CallOption) (*DrainNodeResponse, error) { + out := new(DrainNodeResponse) + err := grpc.Invoke(ctx, "/api.Swarm/DrainNode", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) CreateTask(ctx context.Context, in *CreateTaskRequest, opts ...grpc.CallOption) (*CreateTaskResponse, error) { + out := new(CreateTaskResponse) + err := grpc.Invoke(ctx, "/api.Swarm/CreateTask", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) GetTasks(ctx context.Context, in *GetTasksRequest, opts ...grpc.CallOption) (*GetTasksResponse, error) { + out := new(GetTasksResponse) + err := grpc.Invoke(ctx, "/api.Swarm/GetTasks", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) RemoveTask(ctx context.Context, in *RemoveTaskRequest, opts ...grpc.CallOption) (*RemoveTaskResponse, error) { + out := new(RemoveTaskResponse) + err := grpc.Invoke(ctx, "/api.Swarm/RemoveTask", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) ListTasks(ctx context.Context, in *ListTasksRequest, opts ...grpc.CallOption) (*ListTasksResponse, error) { + out := new(ListTasksResponse) + err := grpc.Invoke(ctx, "/api.Swarm/ListTasks", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) CreateJob(ctx context.Context, in *CreateJobRequest, opts ...grpc.CallOption) (*CreateJobResponse, error) { + out := new(CreateJobResponse) + err := grpc.Invoke(ctx, "/api.Swarm/CreateJob", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) GetJob(ctx context.Context, in *GetJobRequest, opts ...grpc.CallOption) (*GetJobResponse, error) { + out := new(GetJobResponse) + err := grpc.Invoke(ctx, "/api.Swarm/GetJob", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) UpdateJob(ctx context.Context, in *UpdateJobRequest, opts ...grpc.CallOption) (*UpdateJobResponse, error) { + out := new(UpdateJobResponse) + err := grpc.Invoke(ctx, "/api.Swarm/UpdateJob", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) RemoveJob(ctx context.Context, in *RemoveJobRequest, opts ...grpc.CallOption) (*RemoveJobResponse, error) { + out := new(RemoveJobResponse) + err := grpc.Invoke(ctx, "/api.Swarm/RemoveJob", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) ListJobs(ctx context.Context, in *ListJobsRequest, opts ...grpc.CallOption) (*ListJobsResponse, error) { + out := new(ListJobsResponse) + err := grpc.Invoke(ctx, "/api.Swarm/ListJobs", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) UpdateTaskStatus(ctx context.Context, in *UpdateTaskStatusRequest, opts ...grpc.CallOption) (*UpdateTaskStatusResponse, error) { + out := new(UpdateTaskStatusResponse) + err := grpc.Invoke(ctx, "/api.Swarm/UpdateTaskStatus", in, out, c.cc, opts...) + if err != nil { + return nil, err + } + return out, nil +} + +func (c *swarmClient) WatchTasks(ctx context.Context, in *WatchTasksRequest, opts ...grpc.CallOption) (Swarm_WatchTasksClient, error) { + stream, err := grpc.NewClientStream(ctx, &_Swarm_serviceDesc.Streams[0], c.cc, "/api.Swarm/WatchTasks", opts...) + if err != nil { + return nil, err + } + x := &swarmWatchTasksClient{stream} + if err := x.ClientStream.SendMsg(in); err != nil { + return nil, err + } + if err := x.ClientStream.CloseSend(); err != nil { + return nil, err + } + return x, nil +} + +type Swarm_WatchTasksClient interface { + Recv() (*WatchTasksResponse, error) + grpc.ClientStream +} + +type swarmWatchTasksClient struct { + grpc.ClientStream +} + +func (x *swarmWatchTasksClient) Recv() (*WatchTasksResponse, error) { + m := new(WatchTasksResponse) + if err := x.ClientStream.RecvMsg(m); err != nil { + return nil, err + } + return m, nil +} + +// Server API for Swarm service + +type SwarmServer interface { + RegisterNode(context.Context, *RegisterNodeRequest) (*RegisterNodeResponse, error) + UpdateNodeStatus(context.Context, *UpdateNodeStatusRequest) (*UpdateNodeStatusResponse, error) + ListNodes(context.Context, *ListNodesRequest) (*ListNodesResponse, error) + DrainNode(context.Context, *DrainNodeRequest) (*DrainNodeResponse, error) + CreateTask(context.Context, *CreateTaskRequest) (*CreateTaskResponse, error) + GetTasks(context.Context, *GetTasksRequest) (*GetTasksResponse, error) + RemoveTask(context.Context, *RemoveTaskRequest) (*RemoveTaskResponse, error) + ListTasks(context.Context, *ListTasksRequest) (*ListTasksResponse, error) + CreateJob(context.Context, *CreateJobRequest) (*CreateJobResponse, error) + GetJob(context.Context, *GetJobRequest) (*GetJobResponse, error) + UpdateJob(context.Context, *UpdateJobRequest) (*UpdateJobResponse, error) + RemoveJob(context.Context, *RemoveJobRequest) (*RemoveJobResponse, error) + ListJobs(context.Context, *ListJobsRequest) (*ListJobsResponse, error) + UpdateTaskStatus(context.Context, *UpdateTaskStatusRequest) (*UpdateTaskStatusResponse, error) + WatchTasks(*WatchTasksRequest, Swarm_WatchTasksServer) error +} + +func RegisterSwarmServer(s *grpc.Server, srv SwarmServer) { + s.RegisterService(&_Swarm_serviceDesc, srv) +} + +func _Swarm_RegisterNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(RegisterNodeRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).RegisterNode(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_UpdateNodeStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(UpdateNodeStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).UpdateNodeStatus(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_ListNodes_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(ListNodesRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).ListNodes(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_DrainNode_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(DrainNodeRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).DrainNode(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_CreateTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(CreateTaskRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).CreateTask(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_GetTasks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(GetTasksRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).GetTasks(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_RemoveTask_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(RemoveTaskRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).RemoveTask(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_ListTasks_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(ListTasksRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).ListTasks(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_CreateJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(CreateJobRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).CreateJob(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_GetJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(GetJobRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).GetJob(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_UpdateJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(UpdateJobRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).UpdateJob(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_RemoveJob_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(RemoveJobRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).RemoveJob(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_ListJobs_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(ListJobsRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).ListJobs(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_UpdateTaskStatus_Handler(srv interface{}, ctx context.Context, dec func(interface{}) error) (interface{}, error) { + in := new(UpdateTaskStatusRequest) + if err := dec(in); err != nil { + return nil, err + } + out, err := srv.(SwarmServer).UpdateTaskStatus(ctx, in) + if err != nil { + return nil, err + } + return out, nil +} + +func _Swarm_WatchTasks_Handler(srv interface{}, stream grpc.ServerStream) error { + m := new(WatchTasksRequest) + if err := stream.RecvMsg(m); err != nil { + return err + } + return srv.(SwarmServer).WatchTasks(m, &swarmWatchTasksServer{stream}) +} + +type Swarm_WatchTasksServer interface { + Send(*WatchTasksResponse) error + grpc.ServerStream +} + +type swarmWatchTasksServer struct { + grpc.ServerStream +} + +func (x *swarmWatchTasksServer) Send(m *WatchTasksResponse) error { + return x.ServerStream.SendMsg(m) +} + +var _Swarm_serviceDesc = grpc.ServiceDesc{ + ServiceName: "api.Swarm", + HandlerType: (*SwarmServer)(nil), + Methods: []grpc.MethodDesc{ + { + MethodName: "RegisterNode", + Handler: _Swarm_RegisterNode_Handler, + }, + { + MethodName: "UpdateNodeStatus", + Handler: _Swarm_UpdateNodeStatus_Handler, + }, + { + MethodName: "ListNodes", + Handler: _Swarm_ListNodes_Handler, + }, + { + MethodName: "DrainNode", + Handler: _Swarm_DrainNode_Handler, + }, + { + MethodName: "CreateTask", + Handler: _Swarm_CreateTask_Handler, + }, + { + MethodName: "GetTasks", + Handler: _Swarm_GetTasks_Handler, + }, + { + MethodName: "RemoveTask", + Handler: _Swarm_RemoveTask_Handler, + }, + { + MethodName: "ListTasks", + Handler: _Swarm_ListTasks_Handler, + }, + { + MethodName: "CreateJob", + Handler: _Swarm_CreateJob_Handler, + }, + { + MethodName: "GetJob", + Handler: _Swarm_GetJob_Handler, + }, + { + MethodName: "UpdateJob", + Handler: _Swarm_UpdateJob_Handler, + }, + { + MethodName: "RemoveJob", + Handler: _Swarm_RemoveJob_Handler, + }, + { + MethodName: "ListJobs", + Handler: _Swarm_ListJobs_Handler, + }, + { + MethodName: "UpdateTaskStatus", + Handler: _Swarm_UpdateTaskStatus_Handler, + }, + }, + Streams: []grpc.StreamDesc{ + { + StreamName: "WatchTasks", + Handler: _Swarm_WatchTasks_Handler, + ServerStreams: true, + }, + }, +} + +var fileDescriptor0 = []byte{ + // 1228 bytes of a gzipped FileDescriptorProto + 0x1f, 0x8b, 0x08, 0x00, 0x00, 0x09, 0x6e, 0x88, 0x02, 0xff, 0x94, 0x57, 0x4b, 0x6f, 0xdb, 0x46, + 0x10, 0x16, 0xf5, 0xa0, 0xc8, 0xf1, 0x8b, 0x5e, 0xbf, 0x14, 0xc1, 0x49, 0x5c, 0x16, 0x68, 0xd3, + 0x24, 0x35, 0x52, 0xbb, 0x3d, 0xf4, 0x01, 0x04, 0xaa, 0xcd, 0xd8, 0x0a, 0x5c, 0xc5, 0x5d, 0xcb, + 0x30, 0xda, 0x1e, 0x0c, 0xca, 0xdc, 0x3a, 0x6a, 0x6d, 0x8a, 0x25, 0xe9, 0x04, 0x39, 0xf4, 0x58, + 0xa0, 0x7f, 0xa3, 0xff, 0xaa, 0xff, 0xa4, 0x40, 0x4f, 0xd9, 0x27, 0xb9, 0x24, 0xa5, 0x38, 0x39, + 0x59, 0xf3, 0xed, 0xcc, 0x7c, 0xb3, 0x33, 0xc3, 0x8f, 0x34, 0xd8, 0x7e, 0x34, 0xde, 0x8e, 0xe2, + 0x49, 0x3a, 0x41, 0x0d, 0xfa, 0xd3, 0xfd, 0x13, 0x9a, 0x83, 0x49, 0x40, 0xd0, 0x22, 0xd4, 0xc7, + 0x41, 0xc7, 0xd8, 0x32, 0x1e, 0xd8, 0x98, 0xfe, 0x42, 0x08, 0x9a, 0xa1, 0x7f, 0x4d, 0x3a, 0x75, + 0x8e, 0xf0, 0xdf, 0xdc, 0x27, 0xea, 0x34, 0xa5, 0x4f, 0x84, 0x3a, 0xd0, 0x0e, 0x62, 0x7f, 0x1c, + 0x92, 0xa0, 0xd3, 0xa2, 0xa0, 0x85, 0x95, 0x89, 0x3e, 0x05, 0x33, 0x49, 0x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, 0xb8, 0x90, 0xf0, 0xab, 0xa8, + 0x5f, 0x77, 0xa3, 0x82, 0x67, 0x09, 0xbe, 0x06, 0x4b, 0x89, 0x13, 0x5a, 0xe5, 0x6e, 0x25, 0x65, + 0xeb, 0xae, 0x95, 0x50, 0x9d, 0x3b, 0x17, 0x1d, 0xc9, 0x5d, 0xd1, 0x2c, 0xc9, 0x3d, 0x45, 0x9d, + 0xb2, 0xc6, 0x09, 0xf2, 0xbc, 0x71, 0x05, 0xf6, 0xf5, 0x32, 0xac, 0x47, 0x67, 0x02, 0x23, 0xa3, + 0xcb, 0x1a, 0xd5, 0x5d, 0x2f, 0xc3, 0x59, 0xf4, 0x2e, 0x98, 0x42, 0x4a, 0x10, 0x52, 0xf7, 0xd3, + 0xe2, 0x56, 0x0a, 0x98, 0x4e, 0x99, 0xe9, 0x80, 0xa4, 0x2c, 0x2b, 0x8c, 0xa4, 0xac, 0xca, 0x05, + 0x8f, 0xce, 0x54, 0x40, 0x46, 0x97, 0x05, 0xa4, 0xbb, 0x5e, 0x86, 0xf5, 0x41, 0x29, 0x6d, 0x90, + 0x83, 0x2a, 0xa9, 0x47, 0x77, 0xad, 0x84, 0x56, 0x77, 0x5e, 0xfb, 0xfc, 0xd7, 0x77, 0xbe, 0xa2, + 0x1d, 0x85, 0x9d, 0x9f, 0xa2, 0x0e, 0x35, 0xd4, 0x03, 0xc8, 0x9f, 0x78, 0x39, 0xfb, 0x8a, 0x60, + 0xc8, 0xd9, 0x57, 0xa5, 0xc1, 0xad, 0x3d, 0x31, 0x46, 0x26, 0xff, 0x2f, 0x6d, 0xf7, 0x6d, 0x00, + 0x00, 0x00, 0xff, 0xff, 0x49, 0xd2, 0x9a, 0x82, 0xb2, 0x0d, 0x00, 0x00, +} diff --git a/api/api.proto b/api/api.proto new file mode 100644 index 0000000000..751c5a6259 --- /dev/null +++ b/api/api.proto @@ -0,0 +1,270 @@ +syntax = "proto3"; + +package api; + +// TODO(stevvooe): Baseline API specification from POC. Take this to the +// production specification over the next few weeks. + +message Node { + string id = 1; + string name = 2; + string ip = 4; + + bool drained = 5; + NodeStatus status = 3; +} + +enum NodeStatus { + READY = 0; + DOWN = 1; +} + +// Spec defines the properties of a Job. As tasks are created, they gain the +// Job specification. +message Spec { + string name = 1; + + // remote specifies a URL to fetch task bundle data. This can either + // be a git repository or blobster repository. + string remote = 2; + string bundle = 3; // bundle is the commitish of the bundle + string entrypoint = 4; // some specification for what to run. + + int64 instances = 5; + + // TODO(stevvooe): Break up this type into functionality. The comments + // below demonstrate some of the behavior. One example is grouping the + // bundle fields away from the image specification fields. We may also + // want to make each set somewhat generic. For example, there should be a + // "source", that could either be a bundle or image. For the runtime + // parameters, we may have different ones for a Batch Job (cron, perhaps) + // and a Service Job (number of instances). + + // message Bundle { + // string remote = 1; + // string bundle = 2; // bundle is the commitish of the bundle + // string entrypoint = 3; // some specification for what to run. + // } + + // message Service { + // int64 instances = 1; + // } + + // message Batch { + // string cron = 1; + // } + + // message Scheduling { + // repeated string affinity = 2; + // repeated string constraint = 3; + // } +} + +message TaskStatus { + enum State { + NEW = 0; + ASSIGNED = 1; + PREPARING = 2; + READY = 3; + STARTING = 4; + RUNNING = 5; + SHUTDOWN = 6; + COMPLETE = 7; // successful completion of task (not error code, just ran) + FAILED = 8; // task execution failed with error + REJECTED = 9; // task could not be executed here. + FINALIZE = 10; // when task is deallocated from node, waiting on cleanup + DEAD = 11; // completely finished, unallocated task. + } + + State state = 2; + string message = 3; +} + + +message Task { + string id = 1; + string job_id = 2; + + // TODO(stevvooe): Consider bringing back assignment, rather than using a + // node id field. We like having this concept be first-class. It helps to + // reason about storage and consistency. + + string node_id = 3; // if not set, the task is unassigned. + + // NOTE(stevvooe): Spec, status or both may be set, depending on the role + // of this message. + + Spec spec = 4; + TaskStatus status = 5; + + // Networking state + string net_id = 6; + string ep_id = 7; + string ip = 8; + string gateway = 9; + repeated string driver_info = 10; +} + +message Job { + string id = 1; + Spec spec = 2; +} + +message Update { + oneof update { + Node updateNode = 1; + Task updateTask = 2; + Job updateJob = 4; + string deleteNode = 5; + string deleteTask = 6; + string deleteJob = 8; + } +} + +service Swarm { + rpc RegisterNode(RegisterNodeRequest) returns (RegisterNodeResponse) {} + rpc UpdateNodeStatus(UpdateNodeStatusRequest) returns (UpdateNodeStatusResponse) {} + rpc ListNodes(ListNodesRequest) returns (ListNodesResponse) {} + rpc DrainNode(DrainNodeRequest) returns (DrainNodeResponse) {} + + rpc CreateTask(CreateTaskRequest) returns (CreateTaskResponse) {} + rpc GetTasks(GetTasksRequest) returns (GetTasksResponse) {} + rpc RemoveTask(RemoveTaskRequest) returns (RemoveTaskResponse) {} + rpc ListTasks(ListTasksRequest) returns (ListTasksResponse) {} + + rpc CreateJob(CreateJobRequest) returns (CreateJobResponse) {} + rpc GetJob(GetJobRequest) returns (GetJobResponse) {} + rpc UpdateJob(UpdateJobRequest) returns (UpdateJobResponse) {} + rpc RemoveJob(RemoveJobRequest) returns (RemoveJobResponse) {} + rpc ListJobs(ListJobsRequest) returns (ListJobsResponse) {} + + rpc UpdateTaskStatus(UpdateTaskStatusRequest) returns (UpdateTaskStatusResponse) {}; + rpc WatchTasks(WatchTasksRequest) returns (stream WatchTasksResponse){}; + + // TODO(stevvooe): Split this API up into "Agent" and "Control". +} + +message RegisterNodeRequest { + Node node = 1; +} + +message RegisterNodeResponse { + uint64 heartbeat_ttl = 1; +} + +message UpdateNodeStatusRequest { + string node_id = 1; + NodeStatus status = 2; +} + +message UpdateNodeStatusResponse { + uint64 heartbeat_ttl = 1; +} + +message ListNodesRequest { +} + +message ListNodesResponse { + repeated Node nodes = 1; +} + +message DrainNodeRequest { + string node_id = 1; + bool drain = 2; +} + +message DrainNodeResponse { +} + +message CreateTaskRequest { + Spec spec = 1; +} + +message CreateTaskResponse { + string task_id = 1; +} + +message GetTasksRequest { + repeated string task_ids = 1; +} + +message GetTasksResponse { + repeated Task tasks = 1; +} + +message RemoveTaskRequest { + string task_id = 1; +} + +message RemoveTaskResponse { +} + +message ListTasksRequest { +} + +message ListTasksResponse { + repeated Task tasks = 1; +} + +message CreateJobRequest { + Spec spec = 1; +} + +message CreateJobResponse { + string job_id = 1; +} + +message GetJobRequest { + string job_id = 1; +} + +message GetJobResponse { + Job job = 1; +} + +message UpdateJobRequest { + string job_id = 1; + Spec spec = 2; +} + +message UpdateJobResponse { +} + +message RemoveJobRequest { + string job_id = 1; +} + +message RemoveJobResponse { +} + +message ListJobsRequest { +} + +message ListJobsResponse { + repeated Job jobs = 1; +} + +message UpdateTaskStatusRequest { + // Tasks should contain all statuses for running tasks. Only the status + // field must be set. The spec is not required. + repeated Task tasks = 1; +} + +message UpdateTaskStatusResponse{ + // void +} + + + +message WatchTasksRequest { + // TODO(stevvooe): Really, node id assignments should be done through + // headers and sessionization. + + string node_id = 1; +} + +message WatchTasksResponse { + // Tasks is the set of tasks that should be running on the node. + // Tasks outside of this set running on the node should be terminated. + repeated Task tasks = 1; +} diff --git a/api/gen.go b/api/gen.go new file mode 100644 index 0000000000..277e31da9c --- /dev/null +++ b/api/gen.go @@ -0,0 +1,3 @@ +//go:generate protoc --go_out=plugins=grpc:. api.proto + +package api