abstract_operation.go raw

   1  package operation
   2  
   3  import (
   4  	"context"
   5  	"time"
   6  
   7  	"google.golang.org/grpc"
   8  	"google.golang.org/protobuf/proto"
   9  )
  10  
  11  type AbstractOperation interface {
  12  	ID() string
  13  	Description() string
  14  	CreatedBy() string
  15  	CreatedAt() time.Time
  16  	Metadata() proto.Message
  17  	ResourceID() string
  18  	Done() bool
  19  	PollOnce(ctx context.Context, opts ...grpc.CallOption) error
  20  	Wait(ctx context.Context, opts ...grpc.CallOption) (proto.Message, error)
  21  	Error() error
  22  	Response() proto.Message
  23  	Result() OperationResult
  24  }
  25  
  26  type OperationResult interface {
  27  	Response() proto.Message
  28  	Metadata() proto.Message
  29  	Error() error
  30  }
  31