protoregistry

package
v14.1.1 Latest Latest
Warning

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

Go to latest
Published: Jul 28, 2021 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
)

type Registry

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

Registry contains info about RPC methods

var (
	// GitalyProtoPreregistered is a proto registry pre-registered with all
	// gitalypb.GitalyProtos proto files.
	GitalyProtoPreregistered *Registry
)

func New

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

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

func NewFromPaths added in v14.1.0

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