resource

package module
v0.0.0-...-3c1a5ab Latest Latest
Warning

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

Go to latest
Published: Nov 6, 2024 License: AGPL-3.0 Imports: 67 Imported by: 1

Documentation

Overview

Package resource creates a ResourceServer that handles generic storage operations

Index

Constants

View Source
const (
	ResourceStore_Read_FullMethodName   = "/resource.ResourceStore/Read"
	ResourceStore_Create_FullMethodName = "/resource.ResourceStore/Create"
	ResourceStore_Update_FullMethodName = "/resource.ResourceStore/Update"
	ResourceStore_Delete_FullMethodName = "/resource.ResourceStore/Delete"
	ResourceStore_List_FullMethodName   = "/resource.ResourceStore/List"
	ResourceStore_Watch_FullMethodName  = "/resource.ResourceStore/Watch"
)
View Source
const (
	ResourceIndex_Search_FullMethodName  = "/resource.ResourceIndex/Search"
	ResourceIndex_History_FullMethodName = "/resource.ResourceIndex/History"
	ResourceIndex_Origin_FullMethodName  = "/resource.ResourceIndex/Origin"
)
View Source
const (
	BlobStore_PutBlob_FullMethodName = "/resource.BlobStore/PutBlob"
	BlobStore_GetBlob_FullMethodName = "/resource.BlobStore/GetBlob"
)
View Source
const (
	Diagnostics_IsHealthy_FullMethodName = "/resource.Diagnostics/IsHealthy"
)

Variables

View Source
var (
	ErrOptimisticLockingFailed = errors.New("optimistic locking failed")
	ErrNotImplementedYet       = errors.New("not implemented yet")
)

Package-level errors.

View Source
var (
	ResourceVersionMatch_name = map[int32]string{
		0: "NotOlderThan",
		1: "Exact",
	}
	ResourceVersionMatch_value = map[string]int32{
		"NotOlderThan": 0,
		"Exact":        1,
	}
)

Enum value maps for ResourceVersionMatch.

View Source
var (
	WatchEvent_Type_name = map[int32]string{
		0: "UNKNOWN",
		1: "ADDED",
		2: "MODIFIED",
		3: "DELETED",
		4: "BOOKMARK",
		5: "ERROR",
	}
	WatchEvent_Type_value = map[string]int32{
		"UNKNOWN":  0,
		"ADDED":    1,
		"MODIFIED": 2,
		"DELETED":  3,
		"BOOKMARK": 4,
		"ERROR":    5,
	}
)

Enum value maps for WatchEvent_Type.

View Source
var (
	HealthCheckResponse_ServingStatus_name = map[int32]string{
		0: "UNKNOWN",
		1: "SERVING",
		2: "NOT_SERVING",
		3: "SERVICE_UNKNOWN",
	}
	HealthCheckResponse_ServingStatus_value = map[string]int32{
		"UNKNOWN":         0,
		"SERVING":         1,
		"NOT_SERVING":     2,
		"SERVICE_UNKNOWN": 3,
	}
)

Enum value maps for HealthCheckResponse_ServingStatus.

View Source
var (
	PutBlobRequest_Method_name = map[int32]string{
		0: "GRPC",
		1: "HTTP",
	}
	PutBlobRequest_Method_value = map[string]int32{
		"GRPC": 0,
		"HTTP": 1,
	}
)

Enum value maps for PutBlobRequest_Method.

View Source
var BlobStore_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "resource.BlobStore",
	HandlerType: (*BlobStoreServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "PutBlob",
			Handler:    _BlobStore_PutBlob_Handler,
		},
		{
			MethodName: "GetBlob",
			Handler:    _BlobStore_GetBlob_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "resource.proto",
}

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

View Source
var Diagnostics_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "resource.Diagnostics",
	HandlerType: (*DiagnosticsServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "IsHealthy",
			Handler:    _Diagnostics_IsHealthy_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "resource.proto",
}

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

View Source
var File_resource_proto protoreflect.FileDescriptor
View Source
var IndexCreationBuckets = []float64{1, 5, 10, 25, 50, 75, 100, 200, 300, 400, 500, 600, 700, 800, 900, 1000}
View Source
var ResourceIndex_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "resource.ResourceIndex",
	HandlerType: (*ResourceIndexServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Search",
			Handler:    _ResourceIndex_Search_Handler,
		},
		{
			MethodName: "History",
			Handler:    _ResourceIndex_History_Handler,
		},
		{
			MethodName: "Origin",
			Handler:    _ResourceIndex_Origin_Handler,
		},
	},
	Streams:  []grpc.StreamDesc{},
	Metadata: "resource.proto",
}

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

View Source
var ResourceStore_ServiceDesc = grpc.ServiceDesc{
	ServiceName: "resource.ResourceStore",
	HandlerType: (*ResourceStoreServer)(nil),
	Methods: []grpc.MethodDesc{
		{
			MethodName: "Read",
			Handler:    _ResourceStore_Read_Handler,
		},
		{
			MethodName: "Create",
			Handler:    _ResourceStore_Create_Handler,
		},
		{
			MethodName: "Update",
			Handler:    _ResourceStore_Update_Handler,
		},
		{
			MethodName: "Delete",
			Handler:    _ResourceStore_Delete_Handler,
		},
		{
			MethodName: "List",
			Handler:    _ResourceStore_List_Handler,
		},
	},
	Streams: []grpc.StreamDesc{
		{
			StreamName:    "Watch",
			Handler:       _ResourceStore_Watch_Handler,
			ServerStreams: true,
		},
	},
	Metadata: "resource.proto",
}

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

Functions

func GetError

func GetError(res *ErrorResult) error

func OpenBlobBucket

func OpenBlobBucket(ctx context.Context, url string) (*blob.Bucket, error)

Called in a context that loaded the possible drivers

func ProvideHealthService

func ProvideHealthService(server DiagnosticsServer) (grpc_health_v1.HealthServer, error)

func RegisterBlobStoreServer

func RegisterBlobStoreServer(s grpc.ServiceRegistrar, srv BlobStoreServer)

func RegisterDiagnosticsServer

func RegisterDiagnosticsServer(s grpc.ServiceRegistrar, srv DiagnosticsServer)

func RegisterResourceIndexServer

func RegisterResourceIndexServer(s grpc.ServiceRegistrar, srv ResourceIndexServer)

func RegisterResourceStoreServer

func RegisterResourceStoreServer(s grpc.ServiceRegistrar, srv ResourceStoreServer)

Types

type BackendReadResponse

type BackendReadResponse struct {
	// Metadata
	Key    *ResourceKey
	Folder string

	// The new resource version
	ResourceVersion int64
	// The properties
	Value []byte
	// Error details
	Error *ErrorResult
}

type BlobConfig

type BlobConfig struct {
	// The CDK configuration URL
	URL string

	// Directly implemented blob support
	Backend BlobSupport
}

type BlobStoreClient

type BlobStoreClient interface {
	// Upload a blob that will be saved in a resource
	PutBlob(ctx context.Context, in *PutBlobRequest, opts ...grpc.CallOption) (*PutBlobResponse, error)
	// Get blob contents.  When possible, this will return a signed URL
	// For large payloads, signed URLs are required to avoid protobuf message size limits
	GetBlob(ctx context.Context, in *GetBlobRequest, opts ...grpc.CallOption) (*GetBlobResponse, error)
}

BlobStoreClient is the client API for BlobStore 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 NewBlobStoreClient

func NewBlobStoreClient(cc grpc.ClientConnInterface) BlobStoreClient

type BlobStoreServer

type BlobStoreServer interface {
	// Upload a blob that will be saved in a resource
	PutBlob(context.Context, *PutBlobRequest) (*PutBlobResponse, error)
	// Get blob contents.  When possible, this will return a signed URL
	// For large payloads, signed URLs are required to avoid protobuf message size limits
	GetBlob(context.Context, *GetBlobRequest) (*GetBlobResponse, error)
}

BlobStoreServer is the server API for BlobStore service. All implementations should embed UnimplementedBlobStoreServer for forward compatibility

type BlobSupport

type BlobSupport interface {
	// Indicates if storage layer supports signed urls
	SupportsSignedURLs() bool

	// Get the raw blob bytes and metadata -- limited to protobuf message size
	// For larger payloads, we should use presigned URLs to upload from the client
	PutResourceBlob(context.Context, *PutBlobRequest) (*PutBlobResponse, error)

	// Get blob contents.  When possible, this will return a signed URL
	// For large payloads, signed URLs are required to avoid protobuf message size limits
	GetResourceBlob(ctx context.Context, resource *ResourceKey, info *utils.BlobInfo, mustProxy bool) (*GetBlobResponse, error)
}

This interface is not exposed to end users directly Access to this interface is already gated by access control

func NewCDKBlobSupport

func NewCDKBlobSupport(ctx context.Context, opts CDKBlobSupportOptions) (BlobSupport, error)

type Broadcaster

type Broadcaster[T any] interface {
	Subscribe(context.Context) (<-chan T, error)
	Unsubscribe(<-chan T)
}

func NewBroadcaster

func NewBroadcaster[T any](ctx context.Context, connect ConnectFunc[T]) (Broadcaster[T], error)

type CDKBackendOptions

type CDKBackendOptions struct {
	Tracer     trace.Tracer
	Bucket     CDKBucket
	RootFolder string
}

type CDKBlobSupportOptions

type CDKBlobSupportOptions struct {
	Tracer        trace.Tracer
	Bucket        CDKBucket
	RootFolder    string
	URLExpiration time.Duration
}

type CDKBucket

CDKBucket is an abstraction that provides the same functionality as gocloud.dev/blob.Bucket It can be used to wrap gocloud.dev/blob.Bucket with some useful things as o11y.

type ConnectFunc

type ConnectFunc[T any] func(chan<- T) error

ConnectFunc is used to initialize the watch implementation. It should do very basic work and checks and it has the chance to return an error. After that, it should fork to a different goroutine with the provided channel and send to it all the new events from the backing database. It is also responsible for closing the provided channel under all circumstances, included returning an error. The caller of this function will only receive from this channel (i.e. it is guaranteed to never send to it or close it), hence providing a safe separation of concerns and preventing panics.

FIXME: this signature suffers from inversion of control. It would also be much simpler if NewBroadcaster receives a context.Context and a <-chan T instead. That would also reduce the scope of the broadcaster to only broadcast to subscribers what it receives on the provided <-chan T. The context.Context is still needed to provide additional values in case we want to add observability into the broadcaster, which we want. The broadcaster should still terminate on either the context being done or the provided channel being closed.

type CreateRequest

type CreateRequest struct {

	// Requires group+resource to be configuired
	// If name is not set, a unique name will be generated
	// The resourceVersion should not be set
	Key *ResourceKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// The resource JSON.
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateRequest) Descriptor deprecated

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

Deprecated: Use CreateRequest.ProtoReflect.Descriptor instead.

func (*CreateRequest) GetKey

func (x *CreateRequest) GetKey() *ResourceKey

func (*CreateRequest) GetValue

func (x *CreateRequest) GetValue() []byte

func (*CreateRequest) ProtoMessage

func (*CreateRequest) ProtoMessage()

func (*CreateRequest) ProtoReflect

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

func (*CreateRequest) Reset

func (x *CreateRequest) Reset()

func (*CreateRequest) String

func (x *CreateRequest) String() string

type CreateResponse

type CreateResponse struct {

	// Error details
	Error *ErrorResult `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	// The updated resource version
	ResourceVersion int64 `protobuf:"varint,2,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// contains filtered or unexported fields
}

func (*CreateResponse) Descriptor deprecated

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

Deprecated: Use CreateResponse.ProtoReflect.Descriptor instead.

func (*CreateResponse) GetError

func (x *CreateResponse) GetError() *ErrorResult

func (*CreateResponse) GetResourceVersion

func (x *CreateResponse) GetResourceVersion() int64

func (*CreateResponse) ProtoMessage

func (*CreateResponse) ProtoMessage()

func (*CreateResponse) ProtoReflect

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

func (*CreateResponse) Reset

func (x *CreateResponse) Reset()

func (*CreateResponse) String

func (x *CreateResponse) String() string

type Data

type Data struct {
	Key   *ResourceKey
	Value *ResourceWrapper
	Uid   string
}

type DeleteRequest

type DeleteRequest struct {
	Key *ResourceKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// The current resource version
	ResourceVersion int64 `protobuf:"varint,2,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// Preconditions: make sure the uid matches the current saved value
	// +optional
	Uid string `protobuf:"bytes,3,opt,name=uid,proto3" json:"uid,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteRequest) Descriptor deprecated

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

Deprecated: Use DeleteRequest.ProtoReflect.Descriptor instead.

func (*DeleteRequest) GetKey

func (x *DeleteRequest) GetKey() *ResourceKey

func (*DeleteRequest) GetResourceVersion

func (x *DeleteRequest) GetResourceVersion() int64

func (*DeleteRequest) GetUid

func (x *DeleteRequest) GetUid() string

func (*DeleteRequest) ProtoMessage

func (*DeleteRequest) ProtoMessage()

func (*DeleteRequest) ProtoReflect

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

func (*DeleteRequest) Reset

func (x *DeleteRequest) Reset()

func (*DeleteRequest) String

func (x *DeleteRequest) String() string

type DeleteResponse

type DeleteResponse struct {

	// Error details
	Error *ErrorResult `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	// The resource version for the deletion marker
	ResourceVersion int64 `protobuf:"varint,2,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// contains filtered or unexported fields
}

func (*DeleteResponse) Descriptor deprecated

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

Deprecated: Use DeleteResponse.ProtoReflect.Descriptor instead.

func (*DeleteResponse) GetError

func (x *DeleteResponse) GetError() *ErrorResult

func (*DeleteResponse) GetResourceVersion

func (x *DeleteResponse) GetResourceVersion() int64

func (*DeleteResponse) ProtoMessage

func (*DeleteResponse) ProtoMessage()

func (*DeleteResponse) ProtoReflect

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

func (*DeleteResponse) Reset

func (x *DeleteResponse) Reset()

func (*DeleteResponse) String

func (x *DeleteResponse) String() string

type DeletedMarker

type DeletedMarker struct {
	metav1.TypeMeta   `json:",inline"`
	metav1.ObjectMeta `json:"metadata,omitempty"`
}

This object is written when an object is deleted

func (*DeletedMarker) DeepCopy

func (in *DeletedMarker) DeepCopy() *DeletedMarker

DeepCopy is an autogenerated deepcopy function, copying the receiver, creating a new DeletedMarker.

func (*DeletedMarker) DeepCopyInto

func (in *DeletedMarker) DeepCopyInto(out *DeletedMarker)

DeepCopyInto is an autogenerated deepcopy function, copying the receiver, writing into out. in must be non-nil.

func (*DeletedMarker) DeepCopyObject

func (in *DeletedMarker) DeepCopyObject() runtime.Object

DeepCopyObject is an autogenerated deepcopy function, copying the receiver, creating a new runtime.Object.

type DiagnosticsClient

type DiagnosticsClient interface {
	// Check if the service is healthy
	IsHealthy(ctx context.Context, in *HealthCheckRequest, opts ...grpc.CallOption) (*HealthCheckResponse, error)
}

DiagnosticsClient is the client API for Diagnostics 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.

Clients can use this service directly NOTE: This is read only, and no read afer write guarantees

type DiagnosticsServer

type DiagnosticsServer interface {
	// Check if the service is healthy
	IsHealthy(context.Context, *HealthCheckRequest) (*HealthCheckResponse, error)
}

DiagnosticsServer is the server API for Diagnostics service. All implementations should embed UnimplementedDiagnosticsServer for forward compatibility

Clients can use this service directly NOTE: This is read only, and no read afer write guarantees

type ErrorCause

type ErrorCause struct {

	// A machine-readable description of the cause of the error. If this value is
	// empty there is no information available.
	Reason string `protobuf:"bytes,1,opt,name=reason,proto3" json:"reason,omitempty"`
	// A human-readable description of the cause of the error.  This field may be
	// presented as-is to a reader.
	// +optional
	Message string `protobuf:"bytes,2,opt,name=message,proto3" json:"message,omitempty"`
	// The field of the resource that has caused this error, as named by its JSON
	// serialization. May include dot and postfix notation for nested attributes.
	// Arrays are zero-indexed.  Fields may appear more than once in an array of
	// causes due to fields having multiple errors.
	// Optional.
	//
	// Examples:
	//
	//	"name" - the field "name" on the current resource
	//	"items[0].name" - the field "name" on the first array entry in "items"
	//
	// +optional
	Field string `protobuf:"bytes,3,opt,name=field,proto3" json:"field,omitempty"`
	// contains filtered or unexported fields
}

func (*ErrorCause) Descriptor deprecated

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

Deprecated: Use ErrorCause.ProtoReflect.Descriptor instead.

func (*ErrorCause) GetField

func (x *ErrorCause) GetField() string

func (*ErrorCause) GetMessage

func (x *ErrorCause) GetMessage() string

func (*ErrorCause) GetReason

func (x *ErrorCause) GetReason() string

func (*ErrorCause) ProtoMessage

func (*ErrorCause) ProtoMessage()

func (*ErrorCause) ProtoReflect

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

func (*ErrorCause) Reset

func (x *ErrorCause) Reset()

func (*ErrorCause) String

func (x *ErrorCause) String() string

type ErrorDetails

type ErrorDetails struct {

	// The name attribute of the resource associated with the status StatusReason
	// (when there is a single name which can be described).
	// +optional
	Name string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	// The group attribute of the resource associated with the status StatusReason.
	// +optional
	Group string `protobuf:"bytes,2,opt,name=group,proto3" json:"group,omitempty"`
	// The kind attribute of the resource associated with the status StatusReason.
	// On some operations may differ from the requested resource Kind.
	// More info: https://git.k8s.io/community/contributors/devel/sig-architecture/api-conventions.md#types-kinds
	// +optional
	Kind string `protobuf:"bytes,3,opt,name=kind,proto3" json:"kind,omitempty"`
	// UID of the resource.
	// (when there is a single resource which can be described).
	// More info: https://kubernetes.io/docs/concepts/overview/working-with-objects/names#uids
	// +optional
	Uid string `protobuf:"bytes,6,opt,name=uid,proto3" json:"uid,omitempty"`
	// The Causes array includes more details associated with the StatusReason
	// failure. Not all StatusReasons may provide detailed causes.
	// +optional
	// +listType=atomic
	Causes []*ErrorCause `protobuf:"bytes,4,rep,name=causes,proto3" json:"causes,omitempty"`
	// If specified, the time in seconds before the operation should be retried. Some errors may indicate
	// the client must take an alternate action - for those errors this field may indicate how long to wait
	// before taking the alternate action.
	// +optional
	RetryAfterSeconds int32 `protobuf:"varint,5,opt,name=retryAfterSeconds,proto3" json:"retryAfterSeconds,omitempty"`
	// contains filtered or unexported fields
}

ErrorDetails is a set of additional properties that MAY be set by the server to provide additional information about a response. The Reason field of a Status object defines what attributes will be set. Clients must ignore fields that do not match the defined type of each attribute, and should assume that any attribute may be empty, invalid, or under defined.

func (*ErrorDetails) Descriptor deprecated

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

Deprecated: Use ErrorDetails.ProtoReflect.Descriptor instead.

func (*ErrorDetails) GetCauses

func (x *ErrorDetails) GetCauses() []*ErrorCause

func (*ErrorDetails) GetGroup

func (x *ErrorDetails) GetGroup() string

func (*ErrorDetails) GetKind

func (x *ErrorDetails) GetKind() string

func (*ErrorDetails) GetName

func (x *ErrorDetails) GetName() string

func (*ErrorDetails) GetRetryAfterSeconds

func (x *ErrorDetails) GetRetryAfterSeconds() int32

func (*ErrorDetails) GetUid

func (x *ErrorDetails) GetUid() string

func (*ErrorDetails) ProtoMessage

func (*ErrorDetails) ProtoMessage()

func (*ErrorDetails) ProtoReflect

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

func (*ErrorDetails) Reset

func (x *ErrorDetails) Reset()

func (*ErrorDetails) String

func (x *ErrorDetails) String() string

type ErrorResult

type ErrorResult struct {

	// A human-readable description of the status of this operation.
	// +optional
	Message string `protobuf:"bytes,1,opt,name=message,proto3" json:"message,omitempty"`
	// A machine-readable description of why this operation is in the
	// "Failure" status. If this value is empty there
	// is no information available. A Reason clarifies an HTTP status
	// code but does not override it.
	// +optional
	Reason string `protobuf:"bytes,2,opt,name=reason,proto3" json:"reason,omitempty"`
	// Extended data associated with the reason.  Each reason may define its
	// own extended details. This field is optional and the data returned
	// is not guaranteed to conform to any schema except that defined by
	// the reason type.
	// +optional
	// +listType=atomic
	Details *ErrorDetails `protobuf:"bytes,3,opt,name=details,proto3" json:"details,omitempty"`
	// Suggested HTTP return code for this status, 0 if not set.
	// +optional
	Code int32 `protobuf:"varint,4,opt,name=code,proto3" json:"code,omitempty"`
	// contains filtered or unexported fields
}

Status structure is copied from: https://github.com/kubernetes/apimachinery/blob/v0.30.1/pkg/apis/meta/v1/generated.proto#L979 However, this is only used for error handling, never for succesful results

func AsErrorResult

func AsErrorResult(err error) *ErrorResult

Convert golang errors to status result errors that can be returned to a client

func NewBadRequestError

func NewBadRequestError(msg string) *ErrorResult

func NewNotFoundError

func NewNotFoundError(key *ResourceKey) *ErrorResult

func (*ErrorResult) Descriptor deprecated

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

Deprecated: Use ErrorResult.ProtoReflect.Descriptor instead.

func (*ErrorResult) GetCode

func (x *ErrorResult) GetCode() int32

func (*ErrorResult) GetDetails

func (x *ErrorResult) GetDetails() *ErrorDetails

func (*ErrorResult) GetMessage

func (x *ErrorResult) GetMessage() string

func (*ErrorResult) GetReason

func (x *ErrorResult) GetReason() string

func (*ErrorResult) ProtoMessage

func (*ErrorResult) ProtoMessage()

func (*ErrorResult) ProtoReflect

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

func (*ErrorResult) Reset

func (x *ErrorResult) Reset()

func (*ErrorResult) String

func (x *ErrorResult) String() string

type EventAppender

type EventAppender = func(context.Context, *WriteEvent) (int64, error)

A function to write events

type GetBlobRequest

type GetBlobRequest struct {
	Resource *ResourceKey `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"`
	// The new resource version
	ResourceVersion int64 `protobuf:"varint,2,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// Do not return a pre-signed URL (when possible)
	MustProxyBytes bool `protobuf:"varint,3,opt,name=must_proxy_bytes,json=mustProxyBytes,proto3" json:"must_proxy_bytes,omitempty"`
	// contains filtered or unexported fields
}

func (*GetBlobRequest) Descriptor deprecated

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

Deprecated: Use GetBlobRequest.ProtoReflect.Descriptor instead.

func (*GetBlobRequest) GetMustProxyBytes

func (x *GetBlobRequest) GetMustProxyBytes() bool

func (*GetBlobRequest) GetResource

func (x *GetBlobRequest) GetResource() *ResourceKey

func (*GetBlobRequest) GetResourceVersion

func (x *GetBlobRequest) GetResourceVersion() int64

func (*GetBlobRequest) ProtoMessage

func (*GetBlobRequest) ProtoMessage()

func (*GetBlobRequest) ProtoReflect

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

func (*GetBlobRequest) Reset

func (x *GetBlobRequest) Reset()

func (*GetBlobRequest) String

func (x *GetBlobRequest) String() string

type GetBlobResponse

type GetBlobResponse struct {

	// Error details
	Error *ErrorResult `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	// (optional) When possible, the system will return a presigned URL
	// that can be used to actually read the full blob+metadata
	// When this is set, neither info nor value will be set
	Url string `protobuf:"bytes,2,opt,name=url,proto3" json:"url,omitempty"`
	// Content type
	ContentType string `protobuf:"bytes,3,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"`
	// The raw object value
	Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*GetBlobResponse) Descriptor deprecated

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

Deprecated: Use GetBlobResponse.ProtoReflect.Descriptor instead.

func (*GetBlobResponse) GetContentType

func (x *GetBlobResponse) GetContentType() string

func (*GetBlobResponse) GetError

func (x *GetBlobResponse) GetError() *ErrorResult

func (*GetBlobResponse) GetUrl

func (x *GetBlobResponse) GetUrl() string

func (*GetBlobResponse) GetValue

func (x *GetBlobResponse) GetValue() []byte

func (*GetBlobResponse) ProtoMessage

func (*GetBlobResponse) ProtoMessage()

func (*GetBlobResponse) ProtoReflect

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

func (*GetBlobResponse) Reset

func (x *GetBlobResponse) Reset()

func (*GetBlobResponse) String

func (x *GetBlobResponse) String() string

type Group

type Group struct {
	Name  string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Count int64  `protobuf:"varint,2,opt,name=count,proto3" json:"count,omitempty"`
	// contains filtered or unexported fields
}

func (*Group) Descriptor deprecated

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

Deprecated: Use Group.ProtoReflect.Descriptor instead.

func (*Group) GetCount

func (x *Group) GetCount() int64

func (*Group) GetName

func (x *Group) GetName() string

func (*Group) ProtoMessage

func (*Group) ProtoMessage()

func (*Group) ProtoReflect

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

func (*Group) Reset

func (x *Group) Reset()

func (*Group) String

func (x *Group) String() string

type GroupBy

type GroupBy struct {
	Name  string `protobuf:"bytes,1,opt,name=name,proto3" json:"name,omitempty"`
	Limit int64  `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
	// contains filtered or unexported fields
}

func (*GroupBy) Descriptor deprecated

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

Deprecated: Use GroupBy.ProtoReflect.Descriptor instead.

func (*GroupBy) GetLimit

func (x *GroupBy) GetLimit() int64

func (*GroupBy) GetName

func (x *GroupBy) GetName() string

func (*GroupBy) ProtoMessage

func (*GroupBy) ProtoMessage()

func (*GroupBy) ProtoReflect

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

func (*GroupBy) Reset

func (x *GroupBy) Reset()

func (*GroupBy) String

func (x *GroupBy) String() string

type HealthCheckRequest

type HealthCheckRequest struct {
	Service string `protobuf:"bytes,1,opt,name=service,proto3" json:"service,omitempty"`
	// contains filtered or unexported fields
}

func (*HealthCheckRequest) Descriptor deprecated

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

Deprecated: Use HealthCheckRequest.ProtoReflect.Descriptor instead.

func (*HealthCheckRequest) GetService

func (x *HealthCheckRequest) GetService() string

func (*HealthCheckRequest) ProtoMessage

func (*HealthCheckRequest) ProtoMessage()

func (*HealthCheckRequest) ProtoReflect

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

func (*HealthCheckRequest) Reset

func (x *HealthCheckRequest) Reset()

func (*HealthCheckRequest) String

func (x *HealthCheckRequest) String() string

type HealthCheckResponse

type HealthCheckResponse struct {
	Status HealthCheckResponse_ServingStatus `protobuf:"varint,1,opt,name=status,proto3,enum=resource.HealthCheckResponse_ServingStatus" json:"status,omitempty"`
	// contains filtered or unexported fields
}

func (*HealthCheckResponse) Descriptor deprecated

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

Deprecated: Use HealthCheckResponse.ProtoReflect.Descriptor instead.

func (*HealthCheckResponse) GetStatus

func (*HealthCheckResponse) ProtoMessage

func (*HealthCheckResponse) ProtoMessage()

func (*HealthCheckResponse) ProtoReflect

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

func (*HealthCheckResponse) Reset

func (x *HealthCheckResponse) Reset()

func (*HealthCheckResponse) String

func (x *HealthCheckResponse) String() string

type HealthCheckResponse_ServingStatus

type HealthCheckResponse_ServingStatus int32
const (
	HealthCheckResponse_UNKNOWN         HealthCheckResponse_ServingStatus = 0
	HealthCheckResponse_SERVING         HealthCheckResponse_ServingStatus = 1
	HealthCheckResponse_NOT_SERVING     HealthCheckResponse_ServingStatus = 2
	HealthCheckResponse_SERVICE_UNKNOWN HealthCheckResponse_ServingStatus = 3 // Used only by the Watch method.
)

func (HealthCheckResponse_ServingStatus) Descriptor

func (HealthCheckResponse_ServingStatus) Enum

func (HealthCheckResponse_ServingStatus) EnumDescriptor deprecated

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

Deprecated: Use HealthCheckResponse_ServingStatus.Descriptor instead.

func (HealthCheckResponse_ServingStatus) Number

func (HealthCheckResponse_ServingStatus) String

func (HealthCheckResponse_ServingStatus) Type

type HistoryRequest

type HistoryRequest struct {

	// Starting from the requested page (other query parameters must match!)
	NextPageToken string `protobuf:"bytes,1,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
	// Maximum number of items to return
	Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
	// Resource identifier
	Key *ResourceKey `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
	// List the deleted values (eg, show trash)
	ShowDeleted bool `protobuf:"varint,4,opt,name=show_deleted,json=showDeleted,proto3" json:"show_deleted,omitempty"`
	// contains filtered or unexported fields
}

func (*HistoryRequest) Descriptor deprecated

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

Deprecated: Use HistoryRequest.ProtoReflect.Descriptor instead.

func (*HistoryRequest) GetKey

func (x *HistoryRequest) GetKey() *ResourceKey

func (*HistoryRequest) GetLimit

func (x *HistoryRequest) GetLimit() int64

func (*HistoryRequest) GetNextPageToken

func (x *HistoryRequest) GetNextPageToken() string

func (*HistoryRequest) GetShowDeleted

func (x *HistoryRequest) GetShowDeleted() bool

func (*HistoryRequest) ProtoMessage

func (*HistoryRequest) ProtoMessage()

func (*HistoryRequest) ProtoReflect

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

func (*HistoryRequest) Reset

func (x *HistoryRequest) Reset()

func (*HistoryRequest) String

func (x *HistoryRequest) String() string

type HistoryResponse

type HistoryResponse struct {
	Items []*ResourceMeta `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	// More results exist... pass this in the next request
	NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
	// ResourceVersion of the list response
	ResourceVersion int64 `protobuf:"varint,3,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// Error details
	Error *ErrorResult `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*HistoryResponse) Descriptor deprecated

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

Deprecated: Use HistoryResponse.ProtoReflect.Descriptor instead.

func (*HistoryResponse) GetError

func (x *HistoryResponse) GetError() *ErrorResult

func (*HistoryResponse) GetItems

func (x *HistoryResponse) GetItems() []*ResourceMeta

func (*HistoryResponse) GetNextPageToken

func (x *HistoryResponse) GetNextPageToken() string

func (*HistoryResponse) GetResourceVersion

func (x *HistoryResponse) GetResourceVersion() int64

func (*HistoryResponse) ProtoMessage

func (*HistoryResponse) ProtoMessage()

func (*HistoryResponse) ProtoReflect

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

func (*HistoryResponse) Reset

func (x *HistoryResponse) Reset()

func (*HistoryResponse) String

func (x *HistoryResponse) String() string

type Index

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

func NewIndex

func NewIndex(s *server, opts Opts, tracer tracing.Tracer) *Index

func (*Index) AddToBatches

func (i *Index) AddToBatches(ctx context.Context, list *ListResponse) ([]string, error)

AddToBatches adds resources to their respective shard's batch returns a list of tenants that have changes

func (*Index) Count

func (i *Index) Count() (uint64, error)

func (*Index) Delete

func (i *Index) Delete(ctx context.Context, uid string, key *ResourceKey) error

func (*Index) Index

func (i *Index) Index(ctx context.Context, data *Data) error

func (*Index) IndexBatches

func (i *Index) IndexBatches(ctx context.Context, maxSize int, tenants []string) error

IndexBatches goes through all the shards and indexes their batches if they are large enough

func (*Index) Init

func (i *Index) Init(ctx context.Context) error

func (*Index) Search

func (i *Index) Search(ctx context.Context, request *SearchRequest) (*IndexResults, error)

type IndexMetrics

type IndexMetrics struct {
	IndexDir    string
	IndexServer *IndexServer

	// metrics
	IndexLatency      *prometheus.HistogramVec
	IndexSize         prometheus.Gauge
	IndexedDocs       prometheus.Gauge
	IndexCreationTime *prometheus.HistogramVec
}
var (
	IndexServerMetrics *IndexMetrics
)

func NewIndexMetrics

func NewIndexMetrics(indexDir string, indexServer *IndexServer) *IndexMetrics

func (*IndexMetrics) Collect

func (s *IndexMetrics) Collect(ch chan<- prometheus.Metric)

func (*IndexMetrics) Describe

func (s *IndexMetrics) Describe(ch chan<- *prometheus.Desc)

type IndexResults

type IndexResults struct {
	Values []IndexedResource
	Groups []*Group
}

type IndexServer

type IndexServer struct {
	ResourceServer
	// contains filtered or unexported fields
}

func (*IndexServer) History

func (is *IndexServer) History(ctx context.Context, req *HistoryRequest) (*HistoryResponse, error)

func (*IndexServer) Init

func (is *IndexServer) Init(ctx context.Context, rs *server) error

Init sets the resource server on the index server so we can call the resource server from the index server TODO: a chicken and egg problem - index server needs the resource server but the resource server is created with the index server

func (*IndexServer) Load

func (is *IndexServer) Load(ctx context.Context) error

Load the index

func (*IndexServer) Origin

func (is *IndexServer) Origin(ctx context.Context, req *OriginRequest) (*OriginResponse, error)

func (*IndexServer) Search

func (is *IndexServer) Search(ctx context.Context, req *SearchRequest) (*SearchResponse, error)

func (*IndexServer) Watch

func (is *IndexServer) Watch(ctx context.Context) error

Watch resources for changes and update the index

type IndexedResource

type IndexedResource struct {
	Uid       string
	Group     string
	Namespace string
	Kind      string
	Name      string
	Title     string
	CreatedAt string
	CreatedBy string
	UpdatedAt string
	UpdatedBy string
	FolderId  string
	Spec      any
}

func NewIndexedResource

func NewIndexedResource(rawResource []byte) (*IndexedResource, error)

NewIndexedResource creates a new IndexedResource from a raw resource. rawResource is the raw json for the resource from unified storage.

func (IndexedResource) FromSearchHit

func (ir IndexedResource) FromSearchHit(hit *search.DocumentMatch) IndexedResource

type InstrumentedBucket

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

func NewInstrumentedBucket

func NewInstrumentedBucket(bucket CDKBucket, reg prometheus.Registerer, tracer trace.Tracer) *InstrumentedBucket

func (*InstrumentedBucket) Attributes

func (b *InstrumentedBucket) Attributes(ctx context.Context, key string) (*blob.Attributes, error)

func (*InstrumentedBucket) List

func (*InstrumentedBucket) ListPage

func (b *InstrumentedBucket) ListPage(ctx context.Context, pageToken []byte, pageSize int, opts *blob.ListOptions) ([]*blob.ListObject, []byte, error)

func (*InstrumentedBucket) ReadAll

func (b *InstrumentedBucket) ReadAll(ctx context.Context, key string) ([]byte, error)

func (*InstrumentedBucket) SignedURL

func (b *InstrumentedBucket) SignedURL(ctx context.Context, key string, opts *blob.SignedURLOptions) (string, error)

func (*InstrumentedBucket) WriteAll

func (b *InstrumentedBucket) WriteAll(ctx context.Context, key string, p []byte, opts *blob.WriterOptions) error

type LifecycleHooks

type LifecycleHooks interface {
	// Called once at initialization
	Init(context.Context) error

	// Stop function -- after calling this, any additional storage functions may error
	Stop(context.Context) error
}

type ListIterator

type ListIterator interface {
	Next() bool // sql.Rows

	// Iterator error (if exts)
	Error() error

	// The token that can be used to start iterating *after* this item
	ContinueToken() string

	// ResourceVersion of the current item
	ResourceVersion() int64

	// Namespace of the current item
	// Used for fast(er) authz filtering
	Namespace() string

	// Name of the current item
	// Used for fast(er) authz filtering
	Name() string

	// Folder of the current item
	// Used for fast(er) authz filtering
	Folder() string

	// Value for the current item
	Value() []byte
}

type ListOptions

type ListOptions struct {

	// Group+Namespace+Resource (not name)
	Key *ResourceKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// (best effort) Match label
	// Allowed to send more results than actually match because the filter will be appled
	// to the resutls agin in the client.  That time with the full field selector
	Labels []*Requirement `protobuf:"bytes,2,rep,name=labels,proto3" json:"labels,omitempty"`
	// (best effort) fields matcher
	// Allowed to send more results than actually match because the filter will be appled
	// to the resutls agin in the client.  That time with the full field selector
	Fields []*Requirement `protobuf:"bytes,3,rep,name=fields,proto3" json:"fields,omitempty"`
	// contains filtered or unexported fields
}

func (*ListOptions) Descriptor deprecated

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

Deprecated: Use ListOptions.ProtoReflect.Descriptor instead.

func (*ListOptions) GetFields

func (x *ListOptions) GetFields() []*Requirement

func (*ListOptions) GetKey

func (x *ListOptions) GetKey() *ResourceKey

func (*ListOptions) GetLabels

func (x *ListOptions) GetLabels() []*Requirement

func (*ListOptions) ProtoMessage

func (*ListOptions) ProtoMessage()

func (*ListOptions) ProtoReflect

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

func (*ListOptions) Reset

func (x *ListOptions) Reset()

func (*ListOptions) String

func (x *ListOptions) String() string

type ListRequest

type ListRequest struct {

	// Starting from the requested page (other query parameters must match!)
	NextPageToken string `protobuf:"bytes,1,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
	// The resource version
	ResourceVersion int64 `protobuf:"varint,2,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// List options
	VersionMatch ResourceVersionMatch `` /* 133-byte string literal not displayed */
	// Maximum number of items to return
	// NOTE responses will also be limited by the response payload size
	Limit int64 `protobuf:"varint,4,opt,name=limit,proto3" json:"limit,omitempty"`
	// Filtering
	Options *ListOptions `protobuf:"bytes,5,opt,name=options,proto3" json:"options,omitempty"`
	// contains filtered or unexported fields
}

func (*ListRequest) Descriptor deprecated

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

Deprecated: Use ListRequest.ProtoReflect.Descriptor instead.

func (*ListRequest) GetLimit

func (x *ListRequest) GetLimit() int64

func (*ListRequest) GetNextPageToken

func (x *ListRequest) GetNextPageToken() string

func (*ListRequest) GetOptions

func (x *ListRequest) GetOptions() *ListOptions

func (*ListRequest) GetResourceVersion

func (x *ListRequest) GetResourceVersion() int64

func (*ListRequest) GetVersionMatch

func (x *ListRequest) GetVersionMatch() ResourceVersionMatch

func (*ListRequest) ProtoMessage

func (*ListRequest) ProtoMessage()

func (*ListRequest) ProtoReflect

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

func (*ListRequest) Reset

func (x *ListRequest) Reset()

func (*ListRequest) String

func (x *ListRequest) String() string

type ListResponse

type ListResponse struct {
	Items []*ResourceWrapper `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	// When more results exist, pass this in the next request
	NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
	// ResourceVersion of the list response
	ResourceVersion int64 `protobuf:"varint,3,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// remainingItemCount is the number of subsequent items in the list which are not included in this
	// list response. If the list request contained label or field selectors, then the number of
	// remaining items is unknown and the field will be left unset and omitted during serialization.
	// If the list is complete (either because it is not chunking or because this is the last chunk),
	// then there are no more remaining items and this field will be left unset and omitted during
	// serialization.
	//
	// The intended use of the remainingItemCount is *estimating* the size of a collection. Clients
	// should not rely on the remainingItemCount to be set or to be exact.
	// +optional
	RemainingItemCount int64 `protobuf:"varint,4,opt,name=remaining_item_count,json=remainingItemCount,proto3" json:"remaining_item_count,omitempty"` // 0 won't be set either (no next page token)
	// Error details
	Error *ErrorResult `protobuf:"bytes,5,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*ListResponse) Descriptor deprecated

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

Deprecated: Use ListResponse.ProtoReflect.Descriptor instead.

func (*ListResponse) GetError

func (x *ListResponse) GetError() *ErrorResult

func (*ListResponse) GetItems

func (x *ListResponse) GetItems() []*ResourceWrapper

func (*ListResponse) GetNextPageToken

func (x *ListResponse) GetNextPageToken() string

func (*ListResponse) GetRemainingItemCount

func (x *ListResponse) GetRemainingItemCount() int64

func (*ListResponse) GetResourceVersion

func (x *ListResponse) GetResourceVersion() int64

func (*ListResponse) ProtoMessage

func (*ListResponse) ProtoMessage()

func (*ListResponse) ProtoReflect

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

func (*ListResponse) Reset

func (x *ListResponse) Reset()

func (*ListResponse) String

func (x *ListResponse) String() string

type Opts

type Opts struct {
	Workers   int    // This controls how many goroutines are used to index objects
	BatchSize int    // This is the batch size for how many objects to add to the index at once
	ListLimit int    // This is how big the List page size is. If the response size is too large, the number of items will be limited by the server.
	IndexDir  string // The directory where the indexes for each tenant are stored
}

type OriginRequest

type OriginRequest struct {

	// Starting from the requested page (other query parameters must match!)
	NextPageToken string `protobuf:"bytes,1,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
	// Maximum number of items to return
	Limit int64 `protobuf:"varint,2,opt,name=limit,proto3" json:"limit,omitempty"`
	// Resource identifier
	Key *ResourceKey `protobuf:"bytes,3,opt,name=key,proto3" json:"key,omitempty"`
	// List the deleted values (eg, show trash)
	Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"`
	// contains filtered or unexported fields
}

func (*OriginRequest) Descriptor deprecated

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

Deprecated: Use OriginRequest.ProtoReflect.Descriptor instead.

func (*OriginRequest) GetKey

func (x *OriginRequest) GetKey() *ResourceKey

func (*OriginRequest) GetLimit

func (x *OriginRequest) GetLimit() int64

func (*OriginRequest) GetNextPageToken

func (x *OriginRequest) GetNextPageToken() string

func (*OriginRequest) GetOrigin

func (x *OriginRequest) GetOrigin() string

func (*OriginRequest) ProtoMessage

func (*OriginRequest) ProtoMessage()

func (*OriginRequest) ProtoReflect

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

func (*OriginRequest) Reset

func (x *OriginRequest) Reset()

func (*OriginRequest) String

func (x *OriginRequest) String() string

type OriginResponse

type OriginResponse struct {
	Items []*ResourceOriginInfo `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	// More results exist... pass this in the next request
	NextPageToken string `protobuf:"bytes,2,opt,name=next_page_token,json=nextPageToken,proto3" json:"next_page_token,omitempty"`
	// ResourceVersion of the list response
	ResourceVersion int64 `protobuf:"varint,3,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// Error details
	Error *ErrorResult `protobuf:"bytes,4,opt,name=error,proto3" json:"error,omitempty"`
	// contains filtered or unexported fields
}

func (*OriginResponse) Descriptor deprecated

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

Deprecated: Use OriginResponse.ProtoReflect.Descriptor instead.

func (*OriginResponse) GetError

func (x *OriginResponse) GetError() *ErrorResult

func (*OriginResponse) GetItems

func (x *OriginResponse) GetItems() []*ResourceOriginInfo

func (*OriginResponse) GetNextPageToken

func (x *OriginResponse) GetNextPageToken() string

func (*OriginResponse) GetResourceVersion

func (x *OriginResponse) GetResourceVersion() int64

func (*OriginResponse) ProtoMessage

func (*OriginResponse) ProtoMessage()

func (*OriginResponse) ProtoReflect

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

func (*OriginResponse) Reset

func (x *OriginResponse) Reset()

func (*OriginResponse) String

func (x *OriginResponse) String() string

type PutBlobRequest

type PutBlobRequest struct {

	// The resource that will use this blob
	// NOTE: the name may not yet exist, but group+resource are required
	Resource *ResourceKey `protobuf:"bytes,1,opt,name=resource,proto3" json:"resource,omitempty"`
	// How to upload
	Method PutBlobRequest_Method `protobuf:"varint,2,opt,name=method,proto3,enum=resource.PutBlobRequest_Method" json:"method,omitempty"`
	// Content type header
	ContentType string `protobuf:"bytes,3,opt,name=content_type,json=contentType,proto3" json:"content_type,omitempty"`
	// Raw value to write
	// Not valid when method == HTTP
	Value []byte `protobuf:"bytes,4,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*PutBlobRequest) Descriptor deprecated

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

Deprecated: Use PutBlobRequest.ProtoReflect.Descriptor instead.

func (*PutBlobRequest) GetContentType

func (x *PutBlobRequest) GetContentType() string

func (*PutBlobRequest) GetMethod

func (x *PutBlobRequest) GetMethod() PutBlobRequest_Method

func (*PutBlobRequest) GetResource

func (x *PutBlobRequest) GetResource() *ResourceKey

func (*PutBlobRequest) GetValue

func (x *PutBlobRequest) GetValue() []byte

func (*PutBlobRequest) ProtoMessage

func (*PutBlobRequest) ProtoMessage()

func (*PutBlobRequest) ProtoReflect

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

func (*PutBlobRequest) Reset

func (x *PutBlobRequest) Reset()

func (*PutBlobRequest) String

func (x *PutBlobRequest) String() string

type PutBlobRequest_Method

type PutBlobRequest_Method int32
const (
	// Use the inline raw []byte
	PutBlobRequest_GRPC PutBlobRequest_Method = 0
	// Get a signed URL and PUT the value
	PutBlobRequest_HTTP PutBlobRequest_Method = 1
)

func (PutBlobRequest_Method) Descriptor

func (PutBlobRequest_Method) Enum

func (PutBlobRequest_Method) EnumDescriptor deprecated

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

Deprecated: Use PutBlobRequest_Method.Descriptor instead.

func (PutBlobRequest_Method) Number

func (PutBlobRequest_Method) String

func (x PutBlobRequest_Method) String() string

func (PutBlobRequest_Method) Type

type PutBlobResponse

type PutBlobResponse struct {

	// Error details
	Error *ErrorResult `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	// The blob uid.  This must be saved into the resource to support access
	Uid string `protobuf:"bytes,2,opt,name=uid,proto3" json:"uid,omitempty"`
	// The URL where this value can be PUT
	Url string `protobuf:"bytes,3,opt,name=url,proto3" json:"url,omitempty"`
	// Size of the uploaded blob
	Size int64 `protobuf:"varint,4,opt,name=size,proto3" json:"size,omitempty"`
	// Content hash used for an etag
	Hash string `protobuf:"bytes,5,opt,name=hash,proto3" json:"hash,omitempty"`
	// Validated mimetype (from content_type)
	MimeType string `protobuf:"bytes,6,opt,name=mime_type,json=mimeType,proto3" json:"mime_type,omitempty"`
	// Validated charset (from content_type)
	Charset string `protobuf:"bytes,7,opt,name=charset,proto3" json:"charset,omitempty"`
	// contains filtered or unexported fields
}

func (*PutBlobResponse) Descriptor deprecated

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

Deprecated: Use PutBlobResponse.ProtoReflect.Descriptor instead.

func (*PutBlobResponse) GetCharset

func (x *PutBlobResponse) GetCharset() string

func (*PutBlobResponse) GetError

func (x *PutBlobResponse) GetError() *ErrorResult

func (*PutBlobResponse) GetHash

func (x *PutBlobResponse) GetHash() string

func (*PutBlobResponse) GetMimeType

func (x *PutBlobResponse) GetMimeType() string

func (*PutBlobResponse) GetSize

func (x *PutBlobResponse) GetSize() int64

func (*PutBlobResponse) GetUid

func (x *PutBlobResponse) GetUid() string

func (*PutBlobResponse) GetUrl

func (x *PutBlobResponse) GetUrl() string

func (*PutBlobResponse) ProtoMessage

func (*PutBlobResponse) ProtoMessage()

func (*PutBlobResponse) ProtoReflect

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

func (*PutBlobResponse) Reset

func (x *PutBlobResponse) Reset()

func (*PutBlobResponse) String

func (x *PutBlobResponse) String() string

type ReadRequest

type ReadRequest struct {
	Key *ResourceKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// Optionally pick an explicit resource version
	ResourceVersion int64 `protobuf:"varint,3,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadRequest) Descriptor deprecated

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

Deprecated: Use ReadRequest.ProtoReflect.Descriptor instead.

func (*ReadRequest) GetKey

func (x *ReadRequest) GetKey() *ResourceKey

func (*ReadRequest) GetResourceVersion

func (x *ReadRequest) GetResourceVersion() int64

func (*ReadRequest) ProtoMessage

func (*ReadRequest) ProtoMessage()

func (*ReadRequest) ProtoReflect

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

func (*ReadRequest) Reset

func (x *ReadRequest) Reset()

func (*ReadRequest) String

func (x *ReadRequest) String() string

type ReadResponse

type ReadResponse struct {

	// Error details
	Error *ErrorResult `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	// The new resource version
	ResourceVersion int64 `protobuf:"varint,2,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// The properties
	Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*ReadResponse) Descriptor deprecated

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

Deprecated: Use ReadResponse.ProtoReflect.Descriptor instead.

func (*ReadResponse) GetError

func (x *ReadResponse) GetError() *ErrorResult

func (*ReadResponse) GetResourceVersion

func (x *ReadResponse) GetResourceVersion() int64

func (*ReadResponse) GetValue

func (x *ReadResponse) GetValue() []byte

func (*ReadResponse) ProtoMessage

func (*ReadResponse) ProtoMessage()

func (*ReadResponse) ProtoReflect

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

func (*ReadResponse) Reset

func (x *ReadResponse) Reset()

func (*ReadResponse) String

func (x *ReadResponse) String() string

type Requirement

type Requirement struct {
	Key      string   `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	Operator string   `protobuf:"bytes,2,opt,name=operator,proto3" json:"operator,omitempty"` // See https://github.com/kubernetes/kubernetes/blob/v1.30.1/staging/src/k8s.io/apimachinery/pkg/selection/operator.go#L21
	Values   []string `protobuf:"bytes,3,rep,name=values,proto3" json:"values,omitempty"`     // typically one value, but depends on the operator
	// contains filtered or unexported fields
}

The label filtering requirements: https://github.com/kubernetes/kubernetes/blob/v1.30.1/staging/src/k8s.io/apimachinery/pkg/labels/selector.go#L141

func (*Requirement) Descriptor deprecated

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

Deprecated: Use Requirement.ProtoReflect.Descriptor instead.

func (*Requirement) GetKey

func (x *Requirement) GetKey() string

func (*Requirement) GetOperator

func (x *Requirement) GetOperator() string

func (*Requirement) GetValues

func (x *Requirement) GetValues() []string

func (*Requirement) ProtoMessage

func (*Requirement) ProtoMessage()

func (*Requirement) ProtoReflect

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

func (*Requirement) Reset

func (x *Requirement) Reset()

func (*Requirement) String

func (x *Requirement) String() string

type ResourceClient

func NewCloudResourceClient

func NewCloudResourceClient(tracer tracing.Tracer, conn *grpc.ClientConn, cfg authnlib.GrpcClientConfig, allowInsecure bool) (ResourceClient, error)

func NewGRPCResourceClient

func NewGRPCResourceClient(tracer tracing.Tracer, conn *grpc.ClientConn) (ResourceClient, error)

func NewLegacyResourceClient

func NewLegacyResourceClient(channel *grpc.ClientConn) ResourceClient

func NewLocalResourceClient

func NewLocalResourceClient(server ResourceServer) ResourceClient

type ResourceIndexClient

type ResourceIndexClient interface {
	Search(ctx context.Context, in *SearchRequest, opts ...grpc.CallOption) (*SearchResponse, error)
	// Show resource history (and trash)
	History(ctx context.Context, in *HistoryRequest, opts ...grpc.CallOption) (*HistoryResponse, error)
	// Used for efficient provisioning
	Origin(ctx context.Context, in *OriginRequest, opts ...grpc.CallOption) (*OriginResponse, error)
}

ResourceIndexClient is the client API for ResourceIndex 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.

Unlike the ResourceStore, this service can be exposed to clients directly It should be implemented with efficient indexes and does not need read-after-write semantics

type ResourceIndexServer

type ResourceIndexServer interface {
	Search(context.Context, *SearchRequest) (*SearchResponse, error)
	// Show resource history (and trash)
	History(context.Context, *HistoryRequest) (*HistoryResponse, error)
	// Used for efficient provisioning
	Origin(context.Context, *OriginRequest) (*OriginResponse, error)
}

ResourceIndexServer is the server API for ResourceIndex service. All implementations should embed UnimplementedResourceIndexServer for forward compatibility

Unlike the ResourceStore, this service can be exposed to clients directly It should be implemented with efficient indexes and does not need read-after-write semantics

func NewResourceIndexServer

func NewResourceIndexServer(cfg *setting.Cfg, tracer tracing.Tracer) ResourceIndexServer

type ResourceIndexer

type ResourceIndexer interface {
	Index(ctx context.Context) (*Index, error)
}

type ResourceKey

type ResourceKey struct {

	// Namespace (tenant)
	Namespace string `protobuf:"bytes,2,opt,name=namespace,proto3" json:"namespace,omitempty"`
	// Resource Group
	Group string `protobuf:"bytes,1,opt,name=group,proto3" json:"group,omitempty"`
	// The resource type
	Resource string `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"`
	// Resource identifier (unique within namespace+group+resource)
	Name string `protobuf:"bytes,4,opt,name=name,proto3" json:"name,omitempty"`
	// contains filtered or unexported fields
}

func (*ResourceKey) Descriptor deprecated

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

Deprecated: Use ResourceKey.ProtoReflect.Descriptor instead.

func (*ResourceKey) GetGroup

func (x *ResourceKey) GetGroup() string

func (*ResourceKey) GetName

func (x *ResourceKey) GetName() string

func (*ResourceKey) GetNamespace

func (x *ResourceKey) GetNamespace() string

func (*ResourceKey) GetResource

func (x *ResourceKey) GetResource() string

func (*ResourceKey) ProtoMessage

func (*ResourceKey) ProtoMessage()

func (*ResourceKey) ProtoReflect

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

func (*ResourceKey) Reset

func (x *ResourceKey) Reset()

func (*ResourceKey) String

func (x *ResourceKey) String() string

type ResourceMeta

type ResourceMeta struct {

	// The resource version
	ResourceVersion int64 `protobuf:"varint,1,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// Size of the full resource body
	Size int32 `protobuf:"varint,3,opt,name=size,proto3" json:"size,omitempty"`
	// Hash for the resource
	Hash string `protobuf:"bytes,4,opt,name=hash,proto3" json:"hash,omitempty"`
	// The kubernetes metadata section (not the full resource)
	// https://github.com/kubernetes/kubernetes/blob/v1.30.2/staging/src/k8s.io/apimachinery/pkg/apis/meta/v1/types.go#L1496
	PartialObjectMeta []byte `protobuf:"bytes,6,opt,name=partial_object_meta,json=partialObjectMeta,proto3" json:"partial_object_meta,omitempty"`
	// contains filtered or unexported fields
}

The history and trash commands need access to commit messages

func (*ResourceMeta) Descriptor deprecated

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

Deprecated: Use ResourceMeta.ProtoReflect.Descriptor instead.

func (*ResourceMeta) GetHash

func (x *ResourceMeta) GetHash() string

func (*ResourceMeta) GetPartialObjectMeta

func (x *ResourceMeta) GetPartialObjectMeta() []byte

func (*ResourceMeta) GetResourceVersion

func (x *ResourceMeta) GetResourceVersion() int64

func (*ResourceMeta) GetSize

func (x *ResourceMeta) GetSize() int32

func (*ResourceMeta) ProtoMessage

func (*ResourceMeta) ProtoMessage()

func (*ResourceMeta) ProtoReflect

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

func (*ResourceMeta) Reset

func (x *ResourceMeta) Reset()

func (*ResourceMeta) String

func (x *ResourceMeta) String() string

type ResourceOriginInfo

type ResourceOriginInfo struct {

	// The resource
	Key *ResourceKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// Size of the full resource body
	ResourceSize int32 `protobuf:"varint,2,opt,name=resource_size,json=resourceSize,proto3" json:"resource_size,omitempty"`
	// Hash for the resource
	ResourceHash string `protobuf:"bytes,3,opt,name=resource_hash,json=resourceHash,proto3" json:"resource_hash,omitempty"`
	// The origin name
	Origin string `protobuf:"bytes,4,opt,name=origin,proto3" json:"origin,omitempty"`
	// Path on the origin
	Path string `protobuf:"bytes,5,opt,name=path,proto3" json:"path,omitempty"`
	// Verification hash from the origin
	Hash string `protobuf:"bytes,6,opt,name=hash,proto3" json:"hash,omitempty"`
	// Change time from the origin
	Timestamp int64 `protobuf:"varint,7,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// contains filtered or unexported fields
}

func (*ResourceOriginInfo) Descriptor deprecated

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

Deprecated: Use ResourceOriginInfo.ProtoReflect.Descriptor instead.

func (*ResourceOriginInfo) GetHash

func (x *ResourceOriginInfo) GetHash() string

func (*ResourceOriginInfo) GetKey

func (x *ResourceOriginInfo) GetKey() *ResourceKey

func (*ResourceOriginInfo) GetOrigin

func (x *ResourceOriginInfo) GetOrigin() string

func (*ResourceOriginInfo) GetPath

func (x *ResourceOriginInfo) GetPath() string

func (*ResourceOriginInfo) GetResourceHash

func (x *ResourceOriginInfo) GetResourceHash() string

func (*ResourceOriginInfo) GetResourceSize

func (x *ResourceOriginInfo) GetResourceSize() int32

func (*ResourceOriginInfo) GetTimestamp

func (x *ResourceOriginInfo) GetTimestamp() int64

func (*ResourceOriginInfo) ProtoMessage

func (*ResourceOriginInfo) ProtoMessage()

func (*ResourceOriginInfo) ProtoReflect

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

func (*ResourceOriginInfo) Reset

func (x *ResourceOriginInfo) Reset()

func (*ResourceOriginInfo) String

func (x *ResourceOriginInfo) String() string

type ResourceServer

ResourceServer implements all gRPC services

func NewResourceServer

func NewResourceServer(opts ResourceServerOptions) (ResourceServer, error)

type ResourceServerOptions

type ResourceServerOptions struct {
	// OTel tracer
	Tracer trace.Tracer

	// Real storage backend
	Backend StorageBackend

	// The blob configuration
	Blob BlobConfig

	// Requests based on a search index
	Index ResourceIndexServer

	// Diagnostics
	Diagnostics DiagnosticsServer

	// Check if a user has access to write folders
	// When this is nil, no resources can have folders configured
	WriteAccess WriteAccessHooks

	// Callbacks for startup and shutdown
	Lifecycle LifecycleHooks

	// Get the current time in unix millis
	Now func() int64

	// Registerer to register prometheus Metrics for the Resource server
	Reg prometheus.Registerer
}

type ResourceStoreClient

type ResourceStoreClient interface {
	Read(ctx context.Context, in *ReadRequest, opts ...grpc.CallOption) (*ReadResponse, error)
	Create(ctx context.Context, in *CreateRequest, opts ...grpc.CallOption) (*CreateResponse, error)
	Update(ctx context.Context, in *UpdateRequest, opts ...grpc.CallOption) (*UpdateResponse, error)
	Delete(ctx context.Context, in *DeleteRequest, opts ...grpc.CallOption) (*DeleteResponse, error)
	// The results *may* include values that should not be returned to the user
	// This will perform best-effort filtering to increase performace.
	// NOTE: storage.Interface is ultimatly responsible for the final filtering
	List(ctx context.Context, in *ListRequest, opts ...grpc.CallOption) (*ListResponse, error)
	// The results *may* include values that should not be returned to the user
	// This will perform best-effort filtering to increase performace.
	// NOTE: storage.Interface is ultimatly responsible for the final filtering
	Watch(ctx context.Context, in *WatchRequest, opts ...grpc.CallOption) (ResourceStore_WatchClient, error)
}

ResourceStoreClient is the client API for ResourceStore 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.

This provides the CRUD+List+Watch support needed for a k8s apiserver The semantics and behaviors of this service are constrained by kubernetes This does not understand the resource schemas, only deals with json bytes Clients should not use this interface directly; it is for use in API Servers

type ResourceStoreServer

type ResourceStoreServer interface {
	Read(context.Context, *ReadRequest) (*ReadResponse, error)
	Create(context.Context, *CreateRequest) (*CreateResponse, error)
	Update(context.Context, *UpdateRequest) (*UpdateResponse, error)
	Delete(context.Context, *DeleteRequest) (*DeleteResponse, error)
	// The results *may* include values that should not be returned to the user
	// This will perform best-effort filtering to increase performace.
	// NOTE: storage.Interface is ultimatly responsible for the final filtering
	List(context.Context, *ListRequest) (*ListResponse, error)
	// The results *may* include values that should not be returned to the user
	// This will perform best-effort filtering to increase performace.
	// NOTE: storage.Interface is ultimatly responsible for the final filtering
	Watch(*WatchRequest, ResourceStore_WatchServer) error
}

ResourceStoreServer is the server API for ResourceStore service. All implementations should embed UnimplementedResourceStoreServer for forward compatibility

This provides the CRUD+List+Watch support needed for a k8s apiserver The semantics and behaviors of this service are constrained by kubernetes This does not understand the resource schemas, only deals with json bytes Clients should not use this interface directly; it is for use in API Servers

type ResourceStore_WatchClient

type ResourceStore_WatchClient interface {
	Recv() (*WatchEvent, error)
	grpc.ClientStream
}

type ResourceStore_WatchServer

type ResourceStore_WatchServer interface {
	Send(*WatchEvent) error
	grpc.ServerStream
}

type ResourceVersionMatch

type ResourceVersionMatch int32
const (
	ResourceVersionMatch_NotOlderThan ResourceVersionMatch = 0
	ResourceVersionMatch_Exact        ResourceVersionMatch = 1
)

func (ResourceVersionMatch) Descriptor

func (ResourceVersionMatch) Enum

func (ResourceVersionMatch) EnumDescriptor deprecated

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

Deprecated: Use ResourceVersionMatch.Descriptor instead.

func (ResourceVersionMatch) Number

func (ResourceVersionMatch) String

func (x ResourceVersionMatch) String() string

func (ResourceVersionMatch) Type

type ResourceWrapper

type ResourceWrapper struct {

	// The resource version
	ResourceVersion int64 `protobuf:"varint,1,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// Full kubernetes json bytes (although the resource version may not be accurate)
	Value []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*ResourceWrapper) Descriptor deprecated

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

Deprecated: Use ResourceWrapper.ProtoReflect.Descriptor instead.

func (*ResourceWrapper) GetResourceVersion

func (x *ResourceWrapper) GetResourceVersion() int64

func (*ResourceWrapper) GetValue

func (x *ResourceWrapper) GetValue() []byte

func (*ResourceWrapper) ProtoMessage

func (*ResourceWrapper) ProtoMessage()

func (*ResourceWrapper) ProtoReflect

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

func (*ResourceWrapper) Reset

func (x *ResourceWrapper) Reset()

func (*ResourceWrapper) String

func (x *ResourceWrapper) String() string

type SearchRequest

type SearchRequest struct {

	// query string for chosen implementation (currently just bleve)
	Query string `protobuf:"bytes,1,opt,name=query,proto3" json:"query,omitempty"`
	// default to bleve
	QueryType string `protobuf:"bytes,2,opt,name=queryType,proto3" json:"queryType,omitempty"`
	Tenant    string `protobuf:"bytes,3,opt,name=tenant,proto3" json:"tenant,omitempty"`
	// resource kind (playlists, dashboards, etc)
	Kind []string `protobuf:"bytes,4,rep,name=kind,proto3" json:"kind,omitempty"`
	// pagination support
	Limit  int64 `protobuf:"varint,5,opt,name=limit,proto3" json:"limit,omitempty"`
	Offset int64 `protobuf:"varint,6,opt,name=offset,proto3" json:"offset,omitempty"`
	// grouping (optional)
	GroupBy []*GroupBy `protobuf:"bytes,8,rep,name=groupBy,proto3" json:"groupBy,omitempty"`
	// contains filtered or unexported fields
}

func (*SearchRequest) Descriptor deprecated

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

Deprecated: Use SearchRequest.ProtoReflect.Descriptor instead.

func (*SearchRequest) GetGroupBy

func (x *SearchRequest) GetGroupBy() []*GroupBy

func (*SearchRequest) GetKind

func (x *SearchRequest) GetKind() []string

func (*SearchRequest) GetLimit

func (x *SearchRequest) GetLimit() int64

func (*SearchRequest) GetOffset

func (x *SearchRequest) GetOffset() int64

func (*SearchRequest) GetQuery

func (x *SearchRequest) GetQuery() string

func (*SearchRequest) GetQueryType

func (x *SearchRequest) GetQueryType() string

func (*SearchRequest) GetTenant

func (x *SearchRequest) GetTenant() string

func (*SearchRequest) ProtoMessage

func (*SearchRequest) ProtoMessage()

func (*SearchRequest) ProtoReflect

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

func (*SearchRequest) Reset

func (x *SearchRequest) Reset()

func (*SearchRequest) String

func (x *SearchRequest) String() string

type SearchResponse

type SearchResponse struct {
	Items  []*ResourceWrapper `protobuf:"bytes,1,rep,name=items,proto3" json:"items,omitempty"`
	Groups []*Group           `protobuf:"bytes,2,rep,name=groups,proto3" json:"groups,omitempty"`
	// contains filtered or unexported fields
}

func (*SearchResponse) Descriptor deprecated

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

Deprecated: Use SearchResponse.ProtoReflect.Descriptor instead.

func (*SearchResponse) GetGroups

func (x *SearchResponse) GetGroups() []*Group

func (*SearchResponse) GetItems

func (x *SearchResponse) GetItems() []*ResourceWrapper

func (*SearchResponse) ProtoMessage

func (*SearchResponse) ProtoMessage()

func (*SearchResponse) ProtoReflect

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

func (*SearchResponse) Reset

func (x *SearchResponse) Reset()

func (*SearchResponse) String

func (x *SearchResponse) String() string

type Shard

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

type SpecFieldMapping

type SpecFieldMapping struct {
	Field string
	Type  string
}

type StorageApiMetrics

type StorageApiMetrics struct {
	WatchEventLatency *prometheus.HistogramVec
}
var (
	StorageServerMetrics *StorageApiMetrics
)

func NewStorageMetrics

func NewStorageMetrics() *StorageApiMetrics

func (*StorageApiMetrics) Collect

func (s *StorageApiMetrics) Collect(ch chan<- prometheus.Metric)

func (*StorageApiMetrics) Describe

func (s *StorageApiMetrics) Describe(ch chan<- *prometheus.Desc)

type StorageBackend

type StorageBackend interface {
	// Write a Create/Update/Delete,
	// NOTE: the contents of WriteEvent have been validated
	// Return the revisionVersion for this event or error
	WriteEvent(context.Context, WriteEvent) (int64, error)

	// Read a resource from storage optionally at an explicit version
	ReadResource(context.Context, *ReadRequest) *BackendReadResponse

	// When the ResourceServer executes a List request, this iterator will
	// query the backend for potential results.  All results will be
	// checked against the kubernetes requirements before finally returning
	// results.  The list options can be used to improve performance
	// but are the the final answer.
	ListIterator(context.Context, *ListRequest, func(ListIterator) error) (int64, error)

	// Get all events from the store
	// For HA setups, this will be more events than the local WriteEvent above!
	WatchWriteEvents(ctx context.Context) (<-chan *WrittenEvent, error)
}

The StorageBackend is an internal abstraction that supports interacting with the underlying raw storage medium. This interface is never exposed directly, it is provided by concrete instances that actually write values.

func NewCDKBackend

func NewCDKBackend(ctx context.Context, opts CDKBackendOptions) (StorageBackend, error)

type UnimplementedBlobStoreServer

type UnimplementedBlobStoreServer struct {
}

UnimplementedBlobStoreServer should be embedded to have forward compatible implementations.

func (UnimplementedBlobStoreServer) GetBlob

func (UnimplementedBlobStoreServer) PutBlob

type UnimplementedDiagnosticsServer

type UnimplementedDiagnosticsServer struct {
}

UnimplementedDiagnosticsServer should be embedded to have forward compatible implementations.

func (UnimplementedDiagnosticsServer) IsHealthy

type UnimplementedResourceIndexServer

type UnimplementedResourceIndexServer struct {
}

UnimplementedResourceIndexServer should be embedded to have forward compatible implementations.

func (UnimplementedResourceIndexServer) History

func (UnimplementedResourceIndexServer) Origin

func (UnimplementedResourceIndexServer) Search

type UnimplementedResourceStoreServer

type UnimplementedResourceStoreServer struct {
}

UnimplementedResourceStoreServer should be embedded to have forward compatible implementations.

func (UnimplementedResourceStoreServer) Create

func (UnimplementedResourceStoreServer) Delete

func (UnimplementedResourceStoreServer) List

func (UnimplementedResourceStoreServer) Read

func (UnimplementedResourceStoreServer) Update

func (UnimplementedResourceStoreServer) Watch

type UnsafeBlobStoreServer

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

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

type UnsafeDiagnosticsServer

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

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

type UnsafeResourceIndexServer

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

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

type UnsafeResourceStoreServer

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

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

type UpdateRequest

type UpdateRequest struct {

	// Full key must be set
	Key *ResourceKey `protobuf:"bytes,1,opt,name=key,proto3" json:"key,omitempty"`
	// The current resource version
	ResourceVersion int64 `protobuf:"varint,2,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// The resource JSON.
	Value []byte `protobuf:"bytes,3,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateRequest) Descriptor deprecated

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

Deprecated: Use UpdateRequest.ProtoReflect.Descriptor instead.

func (*UpdateRequest) GetKey

func (x *UpdateRequest) GetKey() *ResourceKey

func (*UpdateRequest) GetResourceVersion

func (x *UpdateRequest) GetResourceVersion() int64

func (*UpdateRequest) GetValue

func (x *UpdateRequest) GetValue() []byte

func (*UpdateRequest) ProtoMessage

func (*UpdateRequest) ProtoMessage()

func (*UpdateRequest) ProtoReflect

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

func (*UpdateRequest) Reset

func (x *UpdateRequest) Reset()

func (*UpdateRequest) String

func (x *UpdateRequest) String() string

type UpdateResponse

type UpdateResponse struct {

	// Error details
	Error *ErrorResult `protobuf:"bytes,1,opt,name=error,proto3" json:"error,omitempty"`
	// The updated resource version
	ResourceVersion int64 `protobuf:"varint,2,opt,name=resource_version,json=resourceVersion,proto3" json:"resource_version,omitempty"`
	// contains filtered or unexported fields
}

func (*UpdateResponse) Descriptor deprecated

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

Deprecated: Use UpdateResponse.ProtoReflect.Descriptor instead.

func (*UpdateResponse) GetError

func (x *UpdateResponse) GetError() *ErrorResult

func (*UpdateResponse) GetResourceVersion

func (x *UpdateResponse) GetResourceVersion() int64

func (*UpdateResponse) ProtoMessage

func (*UpdateResponse) ProtoMessage()

func (*UpdateResponse) ProtoReflect

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

func (*UpdateResponse) Reset

func (x *UpdateResponse) Reset()

func (*UpdateResponse) String

func (x *UpdateResponse) String() string

type WatchEvent

type WatchEvent struct {

	// Timestamp the event was sent
	Timestamp int64 `protobuf:"varint,1,opt,name=timestamp,proto3" json:"timestamp,omitempty"`
	// Timestamp the event was sent
	Type WatchEvent_Type `protobuf:"varint,2,opt,name=type,proto3,enum=resource.WatchEvent_Type" json:"type,omitempty"`
	// Resource version for the object
	Resource *WatchEvent_Resource `protobuf:"bytes,3,opt,name=resource,proto3" json:"resource,omitempty"`
	// Previous resource version (for update+delete)
	Previous *WatchEvent_Resource `protobuf:"bytes,4,opt,name=previous,proto3" json:"previous,omitempty"`
	// contains filtered or unexported fields
}

func (*WatchEvent) Descriptor deprecated

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

Deprecated: Use WatchEvent.ProtoReflect.Descriptor instead.

func (*WatchEvent) GetPrevious

func (x *WatchEvent) GetPrevious() *WatchEvent_Resource

func (*WatchEvent) GetResource

func (x *WatchEvent) GetResource() *WatchEvent_Resource

func (*WatchEvent) GetTimestamp

func (x *WatchEvent) GetTimestamp() int64

func (*WatchEvent) GetType

func (x *WatchEvent) GetType() WatchEvent_Type

func (*WatchEvent) ProtoMessage

func (*WatchEvent) ProtoMessage()

func (*WatchEvent) ProtoReflect

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

func (*WatchEvent) Reset

func (x *WatchEvent) Reset()

func (*WatchEvent) String

func (x *WatchEvent) String() string

type WatchEvent_Resource

type WatchEvent_Resource struct {
	Version int64  `protobuf:"varint,1,opt,name=version,proto3" json:"version,omitempty"`
	Value   []byte `protobuf:"bytes,2,opt,name=value,proto3" json:"value,omitempty"`
	// contains filtered or unexported fields
}

func (*WatchEvent_Resource) Descriptor deprecated

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

Deprecated: Use WatchEvent_Resource.ProtoReflect.Descriptor instead.

func (*WatchEvent_Resource) GetValue

func (x *WatchEvent_Resource) GetValue() []byte

func (*WatchEvent_Resource) GetVersion

func (x *WatchEvent_Resource) GetVersion() int64

func (*WatchEvent_Resource) ProtoMessage

func (*WatchEvent_Resource) ProtoMessage()

func (*WatchEvent_Resource) ProtoReflect

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

func (*WatchEvent_Resource) Reset

func (x *WatchEvent_Resource) Reset()

func (*WatchEvent_Resource) String

func (x *WatchEvent_Resource) String() string

type WatchEvent_Type

type WatchEvent_Type int32
const (
	WatchEvent_UNKNOWN  WatchEvent_Type = 0
	WatchEvent_ADDED    WatchEvent_Type = 1
	WatchEvent_MODIFIED WatchEvent_Type = 2
	WatchEvent_DELETED  WatchEvent_Type = 3
	WatchEvent_BOOKMARK WatchEvent_Type = 4
	WatchEvent_ERROR    WatchEvent_Type = 5
)

func (WatchEvent_Type) Descriptor

func (WatchEvent_Type) Enum

func (x WatchEvent_Type) Enum() *WatchEvent_Type

func (WatchEvent_Type) EnumDescriptor deprecated

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

Deprecated: Use WatchEvent_Type.Descriptor instead.

func (WatchEvent_Type) Number

func (WatchEvent_Type) String

func (x WatchEvent_Type) String() string

func (WatchEvent_Type) Type

type WatchRequest

type WatchRequest struct {

	// ResourceVersion of last changes. Empty will default to full history
	Since int64 `protobuf:"varint,1,opt,name=since,proto3" json:"since,omitempty"`
	// Additional options
	Options *ListOptions `protobuf:"bytes,3,opt,name=options,proto3" json:"options,omitempty"`
	// Return initial events
	SendInitialEvents bool `protobuf:"varint,4,opt,name=send_initial_events,json=sendInitialEvents,proto3" json:"send_initial_events,omitempty"`
	// When done with initial events, send a bookmark event
	AllowWatchBookmarks bool `protobuf:"varint,5,opt,name=allow_watch_bookmarks,json=allowWatchBookmarks,proto3" json:"allow_watch_bookmarks,omitempty"`
	// contains filtered or unexported fields
}

func (*WatchRequest) Descriptor deprecated

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

Deprecated: Use WatchRequest.ProtoReflect.Descriptor instead.

func (*WatchRequest) GetAllowWatchBookmarks

func (x *WatchRequest) GetAllowWatchBookmarks() bool

func (*WatchRequest) GetOptions

func (x *WatchRequest) GetOptions() *ListOptions

func (*WatchRequest) GetSendInitialEvents

func (x *WatchRequest) GetSendInitialEvents() bool

func (*WatchRequest) GetSince

func (x *WatchRequest) GetSince() int64

func (*WatchRequest) ProtoMessage

func (*WatchRequest) ProtoMessage()

func (*WatchRequest) ProtoReflect

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

func (*WatchRequest) Reset

func (x *WatchRequest) Reset()

func (*WatchRequest) String

func (x *WatchRequest) String() string

type WriteAccessHooks

type WriteAccessHooks struct {
	// Check if a user has access to write folders
	// When this is nil, no resources can have folders configured
	Folder func(ctx context.Context, user claims.AuthInfo, uid string) bool

	// When configured, this will make sure a user is allowed to save to a given origin
	Origin func(ctx context.Context, user claims.AuthInfo, origin string) bool
}

func (*WriteAccessHooks) CanWriteFolder

func (a *WriteAccessHooks) CanWriteFolder(ctx context.Context, user claims.AuthInfo, uid string) error

func (*WriteAccessHooks) CanWriteOrigin

func (a *WriteAccessHooks) CanWriteOrigin(ctx context.Context, user claims.AuthInfo, uid string) error

type WriteEvent

type WriteEvent struct {
	Type       WatchEvent_Type // ADDED, MODIFIED, DELETED
	Key        *ResourceKey    // the request key
	PreviousRV int64           // only for Update+Delete

	// The json payload (without resourceVersion)
	Value []byte

	// Access real fields
	Object utils.GrafanaMetaAccessor

	// Access to the old metadata
	ObjectOld utils.GrafanaMetaAccessor
}

type WrittenEvent

type WrittenEvent struct {
	WriteEvent
	// Metadata
	Folder string

	// The resource version
	ResourceVersion int64

	// Timestamp when the event is created
	Timestamp int64
}

WriteEvents after they include a resource version

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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