bot

package
v0.0.0-...-c47994e Latest Latest
Warning

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

Go to latest
Published: Feb 19, 2026 License: GPL-2.0 Imports: 9 Imported by: 0

Documentation

Index

Constants

View Source
const (
	Bot_Upload_FullMethodName    = "/bot.Bot/Upload"
	Bot_GetStatus_FullMethodName = "/bot.Bot/GetStatus"
	Bot_Run_FullMethodName       = "/bot.Bot/Run"
)

Variables

View Source
var (
	Status_name = map[int32]string{
		0: "Compiling",
		1: "Frozen",
		2: "Running",
	}
	Status_value = map[string]int32{
		"Compiling": 0,
		"Frozen":    1,
		"Running":   2,
	}
)

Enum value maps for Status.

View Source
var Bot_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "bot.Bot",
	HandlerType: (*BotServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "GetStatus",
			Handler:    _Bot_GetStatus_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Upload",
			Handler:       _Bot_Upload_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
		{
			StreamName:    "Run",
			Handler:       _Bot_Run_Handler,
			ServerStreams: true,
			ClientStreams: true,
		},
	},
	Metadata: "bot.proto",
}

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

Functions

func RegisterBotServer

func RegisterBotServer(s grpc.ServiceRegistrar, srv BotServer)

Types

type BotBody

type BotBody struct {
	Data []byte `protobuf:"bytes,1,opt,name=data,proto3" json:"data,omitempty"`
	// contains filtered or unexported fields
}

func (*BotBody) Descriptor deprecated

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

Deprecated: Use BotBody.ProtoReflect.Descriptor instead.

func (*BotBody) GetData

func (x *BotBody) GetData() []byte

func (*BotBody) ProtoMessage

func (*BotBody) ProtoMessage()

func (*BotBody) ProtoReflect

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

func (*BotBody) Reset

func (x *BotBody) Reset()

func (*BotBody) String

func (x *BotBody) String() string

type BotClient

type BotClient interface {
	// Upload a bot. If more than N bots exist, the oldest one will be overwritten and deleted.
	Upload(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BotUploadRequest, BotUploadResponse], error)
	// Get a list of currently uploaded bots. There is a limit of N.
	GetStatus(ctx context.Context, in *Empty, opts ...grpc.CallOption) (*StatusResponse, error)
	// The bot must have already been uploaded.  The Bot is frozen upon disconnect.
	Run(ctx context.Context, opts ...grpc.CallOption) (grpc.BidiStreamingClient[BotIn, BotOut], error)
}

BotClient is the client API for Bot 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 NewBotClient

func NewBotClient(cc grpc.ClientConnInterface) BotClient

type BotHeader

type BotHeader struct {

	// this is a sha256 sum of the wasm body.
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3" json:"hash,omitempty"`
	// make the size as 0 when there is no bot being stored in the validator.
	Size uint32            `protobuf:"varint,2,opt,name=size,proto3" json:"size,omitempty"`
	Env  map[string]string `` /* 133-byte string literal not displayed */
	Args []string          `protobuf:"bytes,4,rep,name=args,proto3" json:"args,omitempty"`
	// contains filtered or unexported fields
}

func (*BotHeader) Descriptor deprecated

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

Deprecated: Use BotHeader.ProtoReflect.Descriptor instead.

func (*BotHeader) GetArgs

func (x *BotHeader) GetArgs() []string

func (*BotHeader) GetEnv

func (x *BotHeader) GetEnv() map[string]string

func (*BotHeader) GetHash

func (x *BotHeader) GetHash() []byte

func (*BotHeader) GetSize

func (x *BotHeader) GetSize() uint32

func (*BotHeader) ProtoMessage

func (*BotHeader) ProtoMessage()

func (*BotHeader) ProtoReflect

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

func (*BotHeader) Reset

func (x *BotHeader) Reset()

func (*BotHeader) String

func (x *BotHeader) String() string

type BotIn

type BotIn struct {

	// Types that are valid to be assigned to In:
	//
	//	*BotIn_Hash
	//	*BotIn_Stdin
	In isBotIn_In `protobuf_oneof:"in"`
	// contains filtered or unexported fields
}

func (*BotIn) Descriptor deprecated

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

Deprecated: Use BotIn.ProtoReflect.Descriptor instead.

func (*BotIn) GetHash

func (x *BotIn) GetHash() []byte

func (*BotIn) GetIn

func (x *BotIn) GetIn() isBotIn_In

func (*BotIn) GetStdin

func (x *BotIn) GetStdin() []byte

func (*BotIn) ProtoMessage

func (*BotIn) ProtoMessage()

func (*BotIn) ProtoReflect

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

func (*BotIn) Reset

func (x *BotIn) Reset()

func (*BotIn) String

func (x *BotIn) String() string

type BotIn_Hash

type BotIn_Hash struct {
	Hash []byte `protobuf:"bytes,1,opt,name=hash,proto3,oneof"`
}

type BotIn_Stdin

type BotIn_Stdin struct {
	Stdin []byte `protobuf:"bytes,2,opt,name=stdin,proto3,oneof"`
}

type BotOut

type BotOut struct {

	// Types that are valid to be assigned to Out:
	//
	//	*BotOut_Stdout
	//	*BotOut_Stderr
	//	*BotOut_KeypairPubkey
	//	*BotOut_Exit
	//	*BotOut_Status
	//	*BotOut_KeepAlive
	Out isBotOut_Out `protobuf_oneof:"out"`
	// contains filtered or unexported fields
}

func (*BotOut) Descriptor deprecated

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

Deprecated: Use BotOut.ProtoReflect.Descriptor instead.

func (*BotOut) GetExit

func (x *BotOut) GetExit() string

func (*BotOut) GetKeepAlive

func (x *BotOut) GetKeepAlive() *BotOut

func (*BotOut) GetKeypairPubkey

func (x *BotOut) GetKeypairPubkey() []byte

func (*BotOut) GetOut

func (x *BotOut) GetOut() isBotOut_Out

func (*BotOut) GetStatus

func (x *BotOut) GetStatus() *StatusTime

func (*BotOut) GetStderr

func (x *BotOut) GetStderr() []byte

func (*BotOut) GetStdout

func (x *BotOut) GetStdout() []byte

func (*BotOut) ProtoMessage

func (*BotOut) ProtoMessage()

func (*BotOut) ProtoReflect

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

func (*BotOut) Reset

func (x *BotOut) Reset()

func (*BotOut) String

func (x *BotOut) String() string

type BotOut_Exit

type BotOut_Exit struct {
	Exit string `protobuf:"bytes,4,opt,name=exit,proto3,oneof"`
}

type BotOut_KeepAlive

type BotOut_KeepAlive struct {
	KeepAlive *BotOut `protobuf:"bytes,6,opt,name=keep_alive,json=keepAlive,proto3,oneof"`
}

type BotOut_KeypairPubkey

type BotOut_KeypairPubkey struct {
	// a private key with this public key has been generated by the wasm bot
	KeypairPubkey []byte `protobuf:"bytes,3,opt,name=keypair_pubkey,json=keypairPubkey,proto3,oneof"`
}

type BotOut_Status

type BotOut_Status struct {
	Status *StatusTime `protobuf:"bytes,5,opt,name=status,proto3,oneof"`
}

type BotOut_Stderr

type BotOut_Stderr struct {
	Stderr []byte `protobuf:"bytes,2,opt,name=stderr,proto3,oneof"`
}

type BotOut_Stdout

type BotOut_Stdout struct {
	Stdout []byte `protobuf:"bytes,1,opt,name=stdout,proto3,oneof"`
}

type BotServer

type BotServer interface {
	// Upload a bot. If more than N bots exist, the oldest one will be overwritten and deleted.
	Upload(grpc.BidiStreamingServer[BotUploadRequest, BotUploadResponse]) error
	// Get a list of currently uploaded bots. There is a limit of N.
	GetStatus(context.Context, *Empty) (*StatusResponse, error)
	// The bot must have already been uploaded.  The Bot is frozen upon disconnect.
	Run(grpc.BidiStreamingServer[BotIn, BotOut]) error
	// contains filtered or unexported methods
}

BotServer is the server API for Bot service. All implementations must embed UnimplementedBotServer for forward compatibility.

type BotStatus

type BotStatus struct {
	Header *BotHeader  `protobuf:"bytes,1,opt,name=header,proto3" json:"header,omitempty"`
	Status *StatusTime `protobuf:"bytes,2,opt,name=status,proto3" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*BotStatus) Descriptor deprecated

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

Deprecated: Use BotStatus.ProtoReflect.Descriptor instead.

func (*BotStatus) GetHeader

func (x *BotStatus) GetHeader() *BotHeader

func (*BotStatus) GetStatus

func (x *BotStatus) GetStatus() *StatusTime

func (*BotStatus) ProtoMessage

func (*BotStatus) ProtoMessage()

func (*BotStatus) ProtoReflect

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

func (*BotStatus) Reset

func (x *BotStatus) Reset()

func (*BotStatus) String

func (x *BotStatus) String() string

type BotUploadRequest

type BotUploadRequest struct {

	// Types that are valid to be assigned to Payload:
	//
	//	*BotUploadRequest_Header
	//	*BotUploadRequest_Body
	Payload isBotUploadRequest_Payload `protobuf_oneof:"payload"`
	// contains filtered or unexported fields
}

func (*BotUploadRequest) Descriptor deprecated

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

Deprecated: Use BotUploadRequest.ProtoReflect.Descriptor instead.

func (*BotUploadRequest) GetBody

func (x *BotUploadRequest) GetBody() *BotBody

func (*BotUploadRequest) GetHeader

func (x *BotUploadRequest) GetHeader() *BotHeader

func (*BotUploadRequest) GetPayload

func (x *BotUploadRequest) GetPayload() isBotUploadRequest_Payload

func (*BotUploadRequest) ProtoMessage

func (*BotUploadRequest) ProtoMessage()

func (*BotUploadRequest) ProtoReflect

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

func (*BotUploadRequest) Reset

func (x *BotUploadRequest) Reset()

func (*BotUploadRequest) String

func (x *BotUploadRequest) String() string

type BotUploadRequest_Body

type BotUploadRequest_Body struct {
	Body *BotBody `protobuf:"bytes,2,opt,name=body,proto3,oneof"`
}

type BotUploadRequest_Header

type BotUploadRequest_Header struct {
	Header *BotHeader `protobuf:"bytes,1,opt,name=header,proto3,oneof"`
}

type BotUploadResponse

type BotUploadResponse struct {

	// Types that are valid to be assigned to Response:
	//
	//	*BotUploadResponse_Out
	//	*BotUploadResponse_Result
	Response isBotUploadResponse_Response `protobuf_oneof:"response"`
	// contains filtered or unexported fields
}

func (*BotUploadResponse) Descriptor deprecated

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

Deprecated: Use BotUploadResponse.ProtoReflect.Descriptor instead.

func (*BotUploadResponse) GetOut

func (x *BotUploadResponse) GetOut() *BotOut

func (*BotUploadResponse) GetResponse

func (x *BotUploadResponse) GetResponse() isBotUploadResponse_Response

func (*BotUploadResponse) GetResult

func (x *BotUploadResponse) GetResult() *BotStatus

func (*BotUploadResponse) ProtoMessage

func (*BotUploadResponse) ProtoMessage()

func (*BotUploadResponse) ProtoReflect

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

func (*BotUploadResponse) Reset

func (x *BotUploadResponse) Reset()

func (*BotUploadResponse) String

func (x *BotUploadResponse) String() string

type BotUploadResponse_Out

type BotUploadResponse_Out struct {
	Out *BotOut `protobuf:"bytes,1,opt,name=out,proto3,oneof"`
}

type BotUploadResponse_Result

type BotUploadResponse_Result struct {
	Result *BotStatus `protobuf:"bytes,2,opt,name=result,proto3,oneof"`
}

type Bot_RunClient

type Bot_RunClient = grpc.BidiStreamingClient[BotIn, BotOut]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Bot_RunServer

type Bot_RunServer = grpc.BidiStreamingServer[BotIn, BotOut]

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Bot_UploadClient

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Bot_UploadServer

This type alias is provided for backwards compatibility with existing code that references the prior non-generic stream type by name.

type Empty

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

func (*Empty) Descriptor deprecated

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

Deprecated: Use Empty.ProtoReflect.Descriptor instead.

func (*Empty) ProtoMessage

func (*Empty) ProtoMessage()

func (*Empty) ProtoReflect

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

func (*Empty) Reset

func (x *Empty) Reset()

func (*Empty) String

func (x *Empty) String() string

type Status

type Status int32
const (
	Status_Compiling Status = 0
	Status_Frozen    Status = 1
	Status_Running   Status = 2
)

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 StatusResponse

type StatusResponse struct {
	List []*BotStatus `protobuf:"bytes,1,rep,name=list,proto3" json:"list,omitempty"`
	// contains filtered or unexported fields
}

func (*StatusResponse) Descriptor deprecated

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

Deprecated: Use StatusResponse.ProtoReflect.Descriptor instead.

func (*StatusResponse) GetList

func (x *StatusResponse) GetList() []*BotStatus

func (*StatusResponse) ProtoMessage

func (*StatusResponse) ProtoMessage()

func (*StatusResponse) ProtoReflect

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

func (*StatusResponse) Reset

func (x *StatusResponse) Reset()

func (*StatusResponse) String

func (x *StatusResponse) String() string

type StatusTime

type StatusTime struct {
	Status Status `protobuf:"varint,1,opt,name=status,proto3,enum=bot.Status" json:"status,omitempty"`
	Time   int64  `protobuf:"varint,2,opt,name=time,proto3" json:"time,omitempty"`
	// contains filtered or unexported fields
}

func (*StatusTime) Descriptor deprecated

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

Deprecated: Use StatusTime.ProtoReflect.Descriptor instead.

func (*StatusTime) GetStatus

func (x *StatusTime) GetStatus() Status

func (*StatusTime) GetTime

func (x *StatusTime) GetTime() int64

func (*StatusTime) ProtoMessage

func (*StatusTime) ProtoMessage()

func (*StatusTime) ProtoReflect

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

func (*StatusTime) Reset

func (x *StatusTime) Reset()

func (*StatusTime) String

func (x *StatusTime) String() string

type UnimplementedBotServer

type UnimplementedBotServer struct{}

UnimplementedBotServer must be embedded to have forward compatible implementations.

NOTE: this should be embedded by value instead of pointer to avoid a nil pointer dereference when methods are called.

func (UnimplementedBotServer) GetStatus

func (UnimplementedBotServer) Run

type UnsafeBotServer

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

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

Jump to

Keyboard shortcuts

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