callerid

package
v2.0.0-alpha1+incompat... Latest Latest
Warning

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

Go to latest
Published: Aug 25, 2015 License: BSD-3-Clause Imports: 6 Imported by: 0

Documentation

Overview

Package callerid stores/retrives CallerIDs (immediate CallerID and effective CallerID) to/from the Context

Index

Constants

View Source
const (
	// FakePrincipal is the principal of testing effective CallerID
	FakePrincipal = "TestPrincipal"
	// FakeComponent is the component of testing effective CallerID
	FakeComponent = "TestComponent"
	// FakeSubcomponent is the subcomponent of testing effective CallerID
	FakeSubcomponent = "TestSubcomponent"
	// FakeUsername is the username of testing immediate CallerID
	FakeUsername = "TestUsername"
)

Variables

This section is empty.

Functions

func EffectiveCallerIDFromContext

func EffectiveCallerIDFromContext(ctx context.Context) *vtpb.CallerID

EffectiveCallerIDFromContext returns the EffectiveCallerID(vtpb.CallerID) stored in the Context, if any

func GetComponent

func GetComponent(ef *vtpb.CallerID) string

GetComponent returns the running process of the effective caller. It can for instance return hostname:port of the servlet initiating the database call, or the container engine ID used by the servlet.

func GetPrincipal

func GetPrincipal(ef *vtpb.CallerID) string

GetPrincipal returns the effective user identifier, which is usually filled in with whoever made the request to the appserver, if the request came from an automated job or another system component. If the request comes directly from the Internet, or if the Vitess client takes action on its own accord, it is okay for this method to return empty string.

func GetSubcomponent

func GetSubcomponent(ef *vtpb.CallerID) string

GetSubcomponent returns a component inisde the process of effective caller, which is responsible for generating this request. Suggested values are a servlet name or an API endpoint name.

func GetUsername

func GetUsername(im *qrpb.VTGateCallerID) string

GetUsername returns the immediate caller of VTGate

func GoRPCEffectiveCallerID

func GoRPCEffectiveCallerID(c *proto.CallerID) *vtpb.CallerID

GoRPCEffectiveCallerID creates new EffectiveCallerID(vtpb.CallerID) from GoRPC's CallerID

func GoRPCImmediateCallerID

func GoRPCImmediateCallerID(v *proto.VTGateCallerID) *qrpb.VTGateCallerID

GoRPCImmediateCallerID creates new ImmediateCallerID(qrpb.VTGateCallerID) from GoRPC's VTGateCallerID

func ImmediateCallerIDFromContext

func ImmediateCallerIDFromContext(ctx context.Context) *qrpb.VTGateCallerID

ImmediateCallerIDFromContext returns the ImmediateCallerID(qrpb.VTGateCallerID) stored in the Context, if any

func NewContext

func NewContext(ctx context.Context, ef *vtpb.CallerID, im *qrpb.VTGateCallerID) context.Context

NewContext adds the provided EffectiveCallerID(vtpb.CallerID) and ImmediateCallerID(qrpb.VTGateCallerID) into the Context

func NewEffectiveCallerID

func NewEffectiveCallerID(principal string, component string, subComponent string) *vtpb.CallerID

NewEffectiveCallerID creates a new vtpb.CallerID with principal, component and subComponent

func NewImmediateCallerID

func NewImmediateCallerID(username string) *qrpb.VTGateCallerID

NewImmediateCallerID creates a qrpb.VTGateCallerID initialized with username

func Tests

func Tests(t *testing.T, im *qrpb.VTGateCallerID, ef *vtpb.CallerID)

Tests performs the necessary testsuite for CallerID operations

Types

This section is empty.

Jump to

Keyboard shortcuts

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