diskerase

package
v0.0.0-...-3736fb9 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jan 18, 2023 License: MIT Imports: 13 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	Status_name = map[int32]string{
		0: "StatusUnknown",
		1: "StatusNotStarted",
		2: "StatusRunning",
		3: "StatusFailed",
		4: "StatusCompleted",
	}
	Status_value = map[string]int32{
		"StatusUnknown":    0,
		"StatusNotStarted": 1,
		"StatusRunning":    2,
		"StatusFailed":     3,
		"StatusCompleted":  4,
	}
)

Enum value maps for Status.

View Source
var File_diskerase_proto protoreflect.FileDescriptor
View Source
var Workflow_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "diskerase.Workflow",
	HandlerType: (*WorkflowServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Submit",
			Handler:    _Workflow_Submit_Handler,
		},
		{
			MethodName: "Exec",
			Handler:    _Workflow_Exec_Handler,
		},
		{
			MethodName: "Status",
			Handler:    _Workflow_Status_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "diskerase.proto",
}

Workflow_ServiceDesc is the grpc.ServiceDesc for Workflow service. It's only intended for direct use with grpc.RegisterService, and not to be introspected or modified (even as a copy)

Functions

func RegisterWorkflowServer

func RegisterWorkflowServer(s grpc.ServiceRegistrar, srv WorkflowServer)

Types

type Block

type Block struct {

	// This describes what the Block is doing.
	Desc string `protobuf:"bytes,1,opt,name=desc,proto3" json:"desc,omitempty"`
	// The amount of concurrency executions. < 1 will default to 1.
	RateLimit int32 `protobuf:"varint,2,opt,name=rate_limit,json=rateLimit,proto3" json:"rate_limit,omitempty"`
	// The Jobs to to execute in this Block.
	Jobs []*Job `protobuf:"bytes,3,rep,name=jobs,proto3" json:"jobs,omitempty"`
	// contains filtered or unexported fields
}

Block is a grouping of Jobs that will be executed concurrently at some rate.

func (*Block) Descriptor deprecated

func (*Block) Descriptor() ([]byte, []int)

Deprecated: Use Block.ProtoReflect.Descriptor instead.

func (*Block) GetDesc

func (x *Block) GetDesc() string

func (*Block) GetJobs

func (x *Block) GetJobs() []*Job

func (*Block) GetRateLimit

func (x *Block) GetRateLimit() int32

func (*Block) ProtoMessage

func (*Block) ProtoMessage()

func (*Block) ProtoReflect

func (x *Block) ProtoReflect() protoreflect.Message

func (*Block) Reset

func (x *Block) Reset()

func (*Block) String

func (x *Block) String() string

type BlockStatus

type BlockStatus struct {

	// The description of the block.
	Desc string `protobuf:"bytes,1,opt,name=desc,proto3" json:"desc,omitempty"`
	// The status of the block.
	Status Status `protobuf:"varint,2,opt,name=status,proto3,enum=diskerase.Status" json:"status,omitempty"`
	// If there any errors in Jobs in the Block.
	HasError bool `protobuf:"varint,3,opt,name=has_error,json=hasError,proto3" json:"has_error,omitempty"`
	// The status of Jobs in the Block.
	Jobs []*JobStatus `protobuf:"bytes,4,rep,name=jobs,proto3" json:"jobs,omitempty"`
	// contains filtered or unexported fields
}

BlockStatus holds the status of block execution.

func (*BlockStatus) Descriptor deprecated

func (*BlockStatus) Descriptor() ([]byte, []int)

Deprecated: Use BlockStatus.ProtoReflect.Descriptor instead.

func (*BlockStatus) GetDesc

func (x *BlockStatus) GetDesc() string

func (*BlockStatus) GetHasError

func (x *BlockStatus) GetHasError() bool

func (*BlockStatus) GetJobs

func (x *BlockStatus) GetJobs() []*JobStatus

func (*BlockStatus) GetStatus

func (x *BlockStatus) GetStatus() Status

func (*BlockStatus) ProtoMessage

func (*BlockStatus) ProtoMessage()

func (*BlockStatus) ProtoReflect

func (x *BlockStatus) ProtoReflect() protoreflect.Message

func (*BlockStatus) Reset

func (x *BlockStatus) Reset()

func (*BlockStatus) String

func (x *BlockStatus) String() string

type ExecReq

type ExecReq struct {

	// This is the unique ID of the WorkReq given back
	// by WorkResp.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

ExecReq is used to tell the server to execute a WorkReq that was previously submitted.

func (*ExecReq) Descriptor deprecated

func (*ExecReq) Descriptor() ([]byte, []int)

Deprecated: Use ExecReq.ProtoReflect.Descriptor instead.

func (*ExecReq) GetId

func (x *ExecReq) GetId() string

func (*ExecReq) ProtoMessage

func (*ExecReq) ProtoMessage()

func (*ExecReq) ProtoReflect

func (x *ExecReq) ProtoReflect() protoreflect.Message

func (*ExecReq) Reset

func (x *ExecReq) Reset()

func (*ExecReq) String

func (x *ExecReq) String() string

type ExecResp

type ExecResp struct {
	// contains filtered or unexported fields
}

ExecResp is the response from an ExecReq.

func (*ExecResp) Descriptor deprecated

func (*ExecResp) Descriptor() ([]byte, []int)

Deprecated: Use ExecResp.ProtoReflect.Descriptor instead.

func (*ExecResp) ProtoMessage

func (*ExecResp) ProtoMessage()

func (*ExecResp) ProtoReflect

func (x *ExecResp) ProtoReflect() protoreflect.Message

func (*ExecResp) Reset

func (x *ExecResp) Reset()

func (*ExecResp) String

func (x *ExecResp) String() string

type Job

type Job struct {

	// This is the name of the Job, which must be registered on
	// the server.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// This is a description of what the job is doing.
	Desc string `protobuf:"bytes,2,opt,name=desc,proto3" json:"desc,omitempty"`
	// A mapping of key/value arguments. While the value is a string,
	// it can represent non-string data and will be converted by the
	// Job on the server. See the Job definition for a list of arguments
	// that are mandatory and optional.
	Args map[string]string `` /* 149-byte string literal not displayed */
	// contains filtered or unexported fields
}

Job refers to a Job action that is defined on the server.

func (*Job) Descriptor deprecated

func (*Job) Descriptor() ([]byte, []int)

Deprecated: Use Job.ProtoReflect.Descriptor instead.

func (*Job) GetArgs

func (x *Job) GetArgs() map[string]string

func (*Job) GetDesc

func (x *Job) GetDesc() string

func (*Job) GetName

func (x *Job) GetName() string

func (*Job) ProtoMessage

func (*Job) ProtoMessage()

func (*Job) ProtoReflect

func (x *Job) ProtoReflect() protoreflect.Message

func (*Job) Reset

func (x *Job) Reset()

func (*Job) String

func (x *Job) String() string

type JobStatus

type JobStatus struct {

	// The name of the Job called.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// The description of the Job.
	Desc string `protobuf:"bytes,2,opt,name=desc,proto3" json:"desc,omitempty"`
	// The args for the Job.
	Args map[string]string `` /* 149-byte string literal not displayed */
	// The status of the Job.
	Status Status `protobuf:"varint,4,opt,name=status,proto3,enum=diskerase.Status" json:"status,omitempty"`
	// The error, if there was one.
	Error string `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

JobStatus holds the status of the Jobs.

func (*JobStatus) Descriptor deprecated

func (*JobStatus) Descriptor() ([]byte, []int)

Deprecated: Use JobStatus.ProtoReflect.Descriptor instead.

func (*JobStatus) GetArgs

func (x *JobStatus) GetArgs() map[string]string

func (*JobStatus) GetDesc

func (x *JobStatus) GetDesc() string

func (*JobStatus) GetError

func (x *JobStatus) GetError() string

func (*JobStatus) GetName

func (x *JobStatus) GetName() string

func (*JobStatus) GetStatus

func (x *JobStatus) GetStatus() Status

func (*JobStatus) ProtoMessage

func (*JobStatus) ProtoMessage()

func (*JobStatus) ProtoReflect

func (x *JobStatus) ProtoReflect() protoreflect.Message

func (*JobStatus) Reset

func (x *JobStatus) Reset()

func (*JobStatus) String

func (x *JobStatus) String() string

type Status

type Status int32

Status details the status of a Block or Job.

const (
	// Indicates that there is some bug
	// as the Status for the object was not set.
	Status_StatusUnknown Status = 0
	// The WorkReq, Block or Job has not started execution.
	Status_StatusNotStarted Status = 1
	// The WorkReq, Block or Job is currently executing.
	Status_StatusRunning Status = 2
	// The WorkReq, Block or Job has failed.
	Status_StatusFailed Status = 3
	// The WorkReq, Block or Job has completed.
	Status_StatusCompleted Status = 4
)

func (Status) Descriptor

func (Status) Descriptor() protoreflect.EnumDescriptor

func (Status) Enum

func (x Status) Enum() *Status

func (Status) EnumDescriptor deprecated

func (Status) EnumDescriptor() ([]byte, []int)

Deprecated: Use Status.Descriptor instead.

func (Status) Number

func (x Status) Number() protoreflect.EnumNumber

func (Status) String

func (x Status) String() string

func (Status) Type

func (Status) Type() protoreflect.EnumType

type StatusReq

type StatusReq struct {

	// The unique ID of the WorkReq.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

StatusReq requests a status update from the server.

func (*StatusReq) Descriptor deprecated

func (*StatusReq) Descriptor() ([]byte, []int)

Deprecated: Use StatusReq.ProtoReflect.Descriptor instead.

func (*StatusReq) GetId

func (x *StatusReq) GetId() string

func (*StatusReq) ProtoMessage

func (*StatusReq) ProtoMessage()

func (*StatusReq) ProtoReflect

func (x *StatusReq) ProtoReflect() protoreflect.Message

func (*StatusReq) Reset

func (x *StatusReq) Reset()

func (*StatusReq) String

func (x *StatusReq) String() string

type StatusResp

type StatusResp struct {

	// The name of the WorkReq.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// The description of the WorkReq.
	Desc string `protobuf:"bytes,2,opt,name=desc,proto3" json:"desc,omitempty"`
	// The overall status of the WorkReq.
	Status Status `protobuf:"varint,3,opt,name=status,proto3,enum=diskerase.Status" json:"status,omitempty"`
	// The status information on the Blocks.
	Blocks []*BlockStatus `protobuf:"bytes,4,rep,name=blocks,proto3" json:"blocks,omitempty"`
	// If we are SatusFailed or StatusCompleted, if
	// there were any errors when run.
	HadErrors bool `protobuf:"varint,5,opt,name=had_errors,json=hadErrors,proto3" json:"had_errors,omitempty"`
	// If the WorkReq was stopped with emergency stop.
	WasEsStopped bool `protobuf:"varint,6,opt,name=was_es_stopped,json=wasEsStopped,proto3" json:"was_es_stopped,omitempty"`
	// contains filtered or unexported fields
}

StatusResp is the status of WorkReq.

func (*StatusResp) CLISummary

func (x *StatusResp) CLISummary(id string) string

CLISummary() provides the StatusResp in a summary format that is useful for viewing in a CLI application. It summarizes all blocks into single lines except for the block that is currently running.

func (*StatusResp) Descriptor deprecated

func (*StatusResp) Descriptor() ([]byte, []int)

Deprecated: Use StatusResp.ProtoReflect.Descriptor instead.

func (*StatusResp) GetBlocks

func (x *StatusResp) GetBlocks() []*BlockStatus

func (*StatusResp) GetDesc

func (x *StatusResp) GetDesc() string

func (*StatusResp) GetHadErrors

func (x *StatusResp) GetHadErrors() bool

func (*StatusResp) GetName

func (x *StatusResp) GetName() string

func (*StatusResp) GetStatus

func (x *StatusResp) GetStatus() Status

func (*StatusResp) GetWasEsStopped

func (x *StatusResp) GetWasEsStopped() bool

func (*StatusResp) ProtoMessage

func (*StatusResp) ProtoMessage()

func (*StatusResp) ProtoReflect

func (x *StatusResp) ProtoReflect() protoreflect.Message

func (*StatusResp) Reset

func (x *StatusResp) Reset()

func (*StatusResp) String

func (x *StatusResp) String() string

type UnimplementedWorkflowServer

type UnimplementedWorkflowServer struct {
}

UnimplementedWorkflowServer must be embedded to have forward compatible implementations.

func (UnimplementedWorkflowServer) Exec

func (UnimplementedWorkflowServer) Status

func (UnimplementedWorkflowServer) Submit

type UnsafeWorkflowServer

type UnsafeWorkflowServer interface {
	// contains filtered or unexported methods
}

UnsafeWorkflowServer may be embedded to opt out of forward compatibility for this service. Use of this interface is not recommended, as added methods to WorkflowServer will result in compilation errors.

type WorkReq

type WorkReq struct {

	// This is used to describe the work to be done. This name
	// must be authorized by having a policy with the same name
	// in the server's policies.json fie.
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// A description of what this is doing.
	Desc string `protobuf:"bytes,2,opt,name=desc,proto3" json:"desc,omitempty"`
	// These are groupings of Jobs. Each block is executed one at
	// a time.
	Blocks []*Block `protobuf:"bytes,3,rep,name=blocks,proto3" json:"blocks,omitempty"`
	// contains filtered or unexported fields
}

WorkReq is the definition of some work to be done by the system.

func (*WorkReq) Descriptor deprecated

func (*WorkReq) Descriptor() ([]byte, []int)

Deprecated: Use WorkReq.ProtoReflect.Descriptor instead.

func (*WorkReq) GetBlocks

func (x *WorkReq) GetBlocks() []*Block

func (*WorkReq) GetDesc

func (x *WorkReq) GetDesc() string

func (*WorkReq) GetName

func (x *WorkReq) GetName() string

func (*WorkReq) ProtoMessage

func (*WorkReq) ProtoMessage()

func (*WorkReq) ProtoReflect

func (x *WorkReq) ProtoReflect() protoreflect.Message

func (*WorkReq) Reset

func (x *WorkReq) Reset()

func (*WorkReq) String

func (x *WorkReq) String() string

type WorkResp

type WorkResp struct {

	// This is the unique ID for this WorkReq.
	Id string `protobuf:"bytes,1,opt,name=id,proto3" json:"id,omitempty"`
	// contains filtered or unexported fields
}

WorkResp details the ID that will be used to refer to a submitted WorkReq.

func (*WorkResp) Descriptor deprecated

func (*WorkResp) Descriptor() ([]byte, []int)

Deprecated: Use WorkResp.ProtoReflect.Descriptor instead.

func (*WorkResp) GetId

func (x *WorkResp) GetId() string

func (*WorkResp) ProtoMessage

func (*WorkResp) ProtoMessage()

func (*WorkResp) ProtoReflect

func (x *WorkResp) ProtoReflect() protoreflect.Message

func (*WorkResp) Reset

func (x *WorkResp) Reset()

func (*WorkResp) String

func (x *WorkResp) String() string

type WorkflowClient

type WorkflowClient interface {
	// Submit the work to the server. This will not execute the work, it will
	// simply verify it against policy and store it for execution.
	Submit(ctx context.Context, in *WorkReq, opts ...grpc.CallOption) (*WorkResp, error)
	// Tell the service to execute a WorkReq submitted earlier.
	Exec(ctx context.Context, in *ExecReq, opts ...grpc.CallOption) (*ExecResp, error)
	// Get the status of a WorkReq.
	Status(ctx context.Context, in *StatusReq, opts ...grpc.CallOption) (*StatusResp, error)
}

WorkflowClient is the client API for Workflow service.

For semantics around ctx use and closing/ending streaming RPCs, please refer to https://pkg.go.dev/google.golang.org/grpc/?tab=doc#ClientConn.NewStream.

func NewWorkflowClient

func NewWorkflowClient(cc grpc.ClientConnInterface) WorkflowClient

type WorkflowServer

type WorkflowServer interface {
	// Submit the work to the server. This will not execute the work, it will
	// simply verify it against policy and store it for execution.
	Submit(context.Context, *WorkReq) (*WorkResp, error)
	// Tell the service to execute a WorkReq submitted earlier.
	Exec(context.Context, *ExecReq) (*ExecResp, error)
	// Get the status of a WorkReq.
	Status(context.Context, *StatusReq) (*StatusResp, error)
	// contains filtered or unexported methods
}

WorkflowServer is the server API for Workflow service. All implementations must embed UnimplementedWorkflowServer for forward compatibility

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL