protoregistry

package
v15.8.0-rc43 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrProtoFieldEmpty = errors.New("proto field is empty")

ErrProtoFieldEmpty indicates the protobuf field is empty

View Source
var ErrTargetRepoMissing = errors.New("empty Repository")

ErrTargetRepoMissing indicates that the target repo is missing or not set

Functions

This section is empty.

Types

type MethodInfo

type MethodInfo struct {
	Operation OpType
	Scope     Scope
	// contains filtered or unexported fields
}

MethodInfo contains metadata about the RPC method. Refer to documentation for message type "OperationMsg" shared.proto in ./proto for more documentation.

func (MethodInfo) AdditionalRepo

func (mi MethodInfo) AdditionalRepo(msg proto.Message) (*gitalypb.Repository, bool, error)

AdditionalRepo returns the additional repository for a protobuf message that needs a storage rewritten if it exists

func (MethodInfo) FullMethodName

func (mi MethodInfo) FullMethodName() string

func (MethodInfo) SetStorage

func (mi MethodInfo) SetStorage(msg proto.Message, storage string) error

SetStorage sets the storage name for a protobuf message

func (MethodInfo) Storage

func (mi MethodInfo) Storage(msg proto.Message) (string, error)

Storage returns the storage name for a protobuf message if it exists

func (MethodInfo) TargetRepo

func (mi MethodInfo) TargetRepo(msg proto.Message) (*gitalypb.Repository, error)

TargetRepo returns the target repository for a protobuf message if it exists

func (MethodInfo) UnmarshalRequestProto

func (mi MethodInfo) UnmarshalRequestProto(b []byte) (proto.Message, error)

UnmarshalRequestProto will unmarshal the bytes into the method's request message type

type OpType

type OpType int

OpType represents the operation type for a RPC method

const (
	// OpUnknown = unknown operation type
	OpUnknown OpType = iota
	// OpAccessor = accessor operation type (ready only)
	OpAccessor
	// OpMutator = mutator operation type (modifies a repository)
	OpMutator
	// OpMaintenance is an operation which performs maintenance-tasks on the repository. It
	// shouldn't ever result in a user-visible change in behaviour, except that it may repair
	// corrupt data.
	OpMaintenance
)

type Registry

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

Registry contains info about RPC methods

var GitalyProtoPreregistered *Registry

GitalyProtoPreregistered is a proto registry pre-registered with all gitalypb.GitalyProtos proto files.

func New

func New(protos ...*descriptorpb.FileDescriptorProto) (*Registry, error)

New creates a new ProtoRegistry with info from one or more descriptor.FileDescriptorProto

func NewFromPaths

func NewFromPaths(paths ...string) (*Registry, error)

NewFromPaths returns a new Registry, initialized with the contents of the provided files.

func (*Registry) IsInterceptedMethod

func (pr *Registry) IsInterceptedMethod(fullMethodName string) bool

IsInterceptedMethod returns whether Praefect intercepts the method call instead of proxying it.

func (*Registry) LookupMethod

func (pr *Registry) LookupMethod(fullMethodName string) (MethodInfo, error)

LookupMethod looks up an MethodInfo by service and method name

func (*Registry) Methods

func (pr *Registry) Methods() []MethodInfo

Methods returns all registered methods

type Scope

type Scope int

Scope represents the intended scope of an RPC method

const (
	// ScopeUnknown is the default scope until determined otherwise
	ScopeUnknown Scope = iota
	// ScopeRepository indicates an RPC's scope is limited to a repository
	ScopeRepository
	// ScopeStorage indicates an RPC is scoped to an entire storage location
	ScopeStorage
)

func (Scope) String

func (s Scope) String() string

Jump to

Keyboard shortcuts

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