cursorpb

package
v0.0.0-...-128afb8 Latest Latest
Warning

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

Go to latest
Published: Nov 30, 2024 License: Apache-2.0 Imports: 5 Imported by: 0

Documentation

Overview

Package cursorpb contains proto messages with pagination cursors.

Index

Constants

This section is empty.

Variables

View Source
var (
	RequestKind_name = map[int32]string{
		0: "REQUEST_KIND_UNSPECIFIED",
		1: "LIST_BOT_EVENTS",
		2: "LIST_BOT_TASKS",
		3: "LIST_BOTS",
		4: "LIST_TASKS",
		5: "LIST_TASK_REQUESTS",
		6: "CANCEL_TASKS",
	}
	RequestKind_value = map[string]int32{
		"REQUEST_KIND_UNSPECIFIED": 0,
		"LIST_BOT_EVENTS":          1,
		"LIST_BOT_TASKS":           2,
		"LIST_BOTS":                3,
		"LIST_TASKS":               4,
		"LIST_TASK_REQUESTS":       5,
		"CANCEL_TASKS":             6,
	}
)

Enum value maps for RequestKind.

View Source
var File_go_chromium_org_luci_swarming_server_cursor_cursorpb_cursor_proto protoreflect.FileDescriptor

Functions

This section is empty.

Types

type BotsCursor

type BotsCursor struct {

	// The last returned bot ID.
	LastBotId string `protobuf:"bytes,1,opt,name=last_bot_id,json=lastBotId,proto3" json:"last_bot_id,omitempty"`
	// contains filtered or unexported fields
}

Cursor used in the bots listing query (there's only one).

Bots are always ordered by bot ID. This cursor just contains the latest returned bot ID. To resume from it, we query for all bots with the ID larger than the one in the cursor.

func (*BotsCursor) Descriptor deprecated

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

Deprecated: Use BotsCursor.ProtoReflect.Descriptor instead.

func (*BotsCursor) GetLastBotId

func (x *BotsCursor) GetLastBotId() string

func (*BotsCursor) ProtoMessage

func (*BotsCursor) ProtoMessage()

func (*BotsCursor) ProtoReflect

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

func (*BotsCursor) Reset

func (x *BotsCursor) Reset()

func (*BotsCursor) String

func (x *BotsCursor) String() string

type Cursor

type Cursor struct {

	// What request this cursor is for. Indirectly identifies what branch of the
	// `payload` oneof is expected to be set.
	Request RequestKind `protobuf:"varint,1,opt,name=request,proto3,enum=swarming.internals.cursor.RequestKind" json:"request,omitempty"`
	// When the cursor was created (for debugging).
	Created *timestamppb.Timestamp `protobuf:"bytes,2,opt,name=created,proto3" json:"created,omitempty"`
	// Possible kinds of cursors, based on RequestKind.
	//
	// Types that are assignable to Payload:
	//
	//	*Cursor_OpaqueCursor
	//	*Cursor_BotsCursor
	//	*Cursor_TasksCursor
	Payload isCursor_Payload `protobuf_oneof:"payload"`
	// contains filtered or unexported fields
}

Cursor is serialized, encrypted and base64-encoded before it is sent to the user.

There are two reasons this exists:

  1. To support "custom" (not native Cloud Datastore) cursors for queries that use "|" tag filters. Such queries are executed by running a bunch of datastore queries in parallel and merging their results. There is no simple working generic mechanism for paginating through such merged output. A custom cursor allows to exploit a known structure of Swarming queries to implement a simple, but Swarming specific, cursor.
  2. To make cursors produced by the Go implementation be easily distinguished from cursors produced by the Python implementation. That allows us to implement a "smart" traffic router that routes RPC calls with Go cursors to the Go implementation.

Encryption allows us not to worry about leaking any data or exposing internal implementation details or worry about users manually messing with cursors.

func (*Cursor) Descriptor deprecated

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

Deprecated: Use Cursor.ProtoReflect.Descriptor instead.

func (*Cursor) GetBotsCursor

func (x *Cursor) GetBotsCursor() *BotsCursor

func (*Cursor) GetCreated

func (x *Cursor) GetCreated() *timestamppb.Timestamp

func (*Cursor) GetOpaqueCursor

func (x *Cursor) GetOpaqueCursor() *OpaqueCursor

func (*Cursor) GetPayload

func (m *Cursor) GetPayload() isCursor_Payload

func (*Cursor) GetRequest

func (x *Cursor) GetRequest() RequestKind

func (*Cursor) GetTasksCursor

func (x *Cursor) GetTasksCursor() *TasksCursor

func (*Cursor) ProtoMessage

func (*Cursor) ProtoMessage()

func (*Cursor) ProtoReflect

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

func (*Cursor) Reset

func (x *Cursor) Reset()

func (*Cursor) String

func (x *Cursor) String() string

type Cursor_BotsCursor

type Cursor_BotsCursor struct {
	BotsCursor *BotsCursor `protobuf:"bytes,11,opt,name=bots_cursor,json=botsCursor,proto3,oneof"`
}

type Cursor_OpaqueCursor

type Cursor_OpaqueCursor struct {
	OpaqueCursor *OpaqueCursor `protobuf:"bytes,10,opt,name=opaque_cursor,json=opaqueCursor,proto3,oneof"`
}

type Cursor_TasksCursor

type Cursor_TasksCursor struct {
	TasksCursor *TasksCursor `protobuf:"bytes,12,opt,name=tasks_cursor,json=tasksCursor,proto3,oneof"`
}

type OpaqueCursor

type OpaqueCursor struct {

	// Base64-decoded cursor returned by the Cloud Datastore API.
	Cursor []byte `protobuf:"bytes,1,opt,name=cursor,proto3" json:"cursor,omitempty"`
	// contains filtered or unexported fields
}

An opaque datastore cursor (in its raw []byte form).

func (*OpaqueCursor) Descriptor deprecated

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

Deprecated: Use OpaqueCursor.ProtoReflect.Descriptor instead.

func (*OpaqueCursor) GetCursor

func (x *OpaqueCursor) GetCursor() []byte

func (*OpaqueCursor) ProtoMessage

func (*OpaqueCursor) ProtoMessage()

func (*OpaqueCursor) ProtoReflect

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

func (*OpaqueCursor) Reset

func (x *OpaqueCursor) Reset()

func (*OpaqueCursor) String

func (x *OpaqueCursor) String() string

type RequestKind

type RequestKind int32

What request a cursor is for. Indirectly identifies what branch of the `payload` oneof is expected to be set.

const (
	RequestKind_REQUEST_KIND_UNSPECIFIED RequestKind = 0
	RequestKind_LIST_BOT_EVENTS          RequestKind = 1 // uses OpaqueCursor
	RequestKind_LIST_BOT_TASKS           RequestKind = 2 // uses OpaqueCursor
	RequestKind_LIST_BOTS                RequestKind = 3 // uses BotsCursor
	RequestKind_LIST_TASKS               RequestKind = 4 // uses TasksCursor
	RequestKind_LIST_TASK_REQUESTS       RequestKind = 5 // uses TasksCursor
	RequestKind_CANCEL_TASKS             RequestKind = 6 // uses TasksCursor
)

func (RequestKind) Descriptor

func (RequestKind) Enum

func (x RequestKind) Enum() *RequestKind

func (RequestKind) EnumDescriptor deprecated

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

Deprecated: Use RequestKind.Descriptor instead.

func (RequestKind) Number

func (x RequestKind) Number() protoreflect.EnumNumber

func (RequestKind) String

func (x RequestKind) String() string

func (RequestKind) Type

type TasksCursor

type TasksCursor struct {

	// The ID of TaskRequest entity of the latest returned task.
	LastTaskRequestEntityId int64 `` /* 137-byte string literal not displayed */
	// contains filtered or unexported fields
}

Cursor used in various task listing queries.

Tasks are currently always ordered by their entity IDs (which encode their creation time). This cursor just contains the latest returned task ID (as the corresponding TaskRequest datastore ID). To resume from it, we query for all entities with the ID larger than the one in the cursor.

func (*TasksCursor) Descriptor deprecated

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

Deprecated: Use TasksCursor.ProtoReflect.Descriptor instead.

func (*TasksCursor) GetLastTaskRequestEntityId

func (x *TasksCursor) GetLastTaskRequestEntityId() int64

func (*TasksCursor) ProtoMessage

func (*TasksCursor) ProtoMessage()

func (*TasksCursor) ProtoReflect

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

func (*TasksCursor) Reset

func (x *TasksCursor) Reset()

func (*TasksCursor) String

func (x *TasksCursor) String() string

Jump to

Keyboard shortcuts

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