...

Package rpc

import "golang.conradwood.net/go-easyops/rpc"
Overview
Index

Overview ▾

deprecated. See ctx package for a replacement implementation.

Constants

const (
    LOCALCONTEXTNAME   = "GOEASYOPS_LOCALCTX"
    LOCALCONTEXTNAMEV2 = "GOEASYOPS_LOCALCTX_V2"
    // timeout for newly created context in this package
    DEFAULT_TIMEOUT_SECS = 10
)

func EnableDebug

func EnableDebug(ctx context.Context)

type CallState

information about our local call stack. this should always have been an interface, really..

type CallState struct {
    // v1
    Debug           bool
    Started         time.Time
    ServiceName     string          // this is our servicename (the one this module exports)
    MethodName      string          // the method that was called (the one we are implementing)
    CallingMethodID uint64          // who called us (maybe 0)
    Context         context.Context // guaranteed to be the most "up-to-date" context.
    MyServiceID     uint64          // that is us (our local serviceid)
    // contains filtered or unexported fields
}

func CallStateFromContext

func CallStateFromContext(ctx context.Context) *CallState

func ContextWithCallState

func ContextWithCallState(ctx context.Context) (context.Context, *CallState)

func (*CallState) CallerService

func (cs *CallState) CallerService() *auth.User

return the authenticated service

func (*CallState) CallerString

func (cs *CallState) CallerString() string

func (*CallState) DISMetadataValue

func (cs *CallState) DISMetadataValue() string

func (*CallState) DebugPrintContext

func (cs *CallState) DebugPrintContext()

print context (if debug enabled)

func (*CallState) IsV2

func (c *CallState) IsV2() bool

func (*CallState) PrintContext

func (cs *CallState) PrintContext()

func (*CallState) RequestID

func (cs *CallState) RequestID() string

func (*CallState) RoutingTags

func (cs *CallState) RoutingTags() *ge.CTXRoutingTags

func (*CallState) SetV2

func (c *CallState) SetV2(lcs LocalCallState)

this now is a "V2" style callstate

func (*CallState) SignedService

func (cs *CallState) SignedService() *auth.SignedUser

func (*CallState) SignedSession

func (cs *CallState) SignedSession() *auth.SignedSession

func (*CallState) SignedUser

func (cs *CallState) SignedUser() *auth.SignedUser

func (*CallState) TargetString

func (cs *CallState) TargetString() string

func (*CallState) UpdateContextFromResponse

func (cs *CallState) UpdateContextFromResponse() error

add the information from the interceptor response into the context it replaces the context data with information held in callstate it adds it in two distinct ways: 1. Accessible as a local context Variable 2. Ready to be transmitted via metadata (in case the context is use for outbound calls)

func (*CallState) UpdateContextFromResponseWithTimeout

func (cs *CallState) UpdateContextFromResponseWithTimeout(t time.Duration) error

func (*CallState) User

func (cs *CallState) User() *auth.User

return the authenticated user

type CallStateV2

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

func (*CallStateV2) CallingService

func (cs *CallStateV2) CallingService() *abp.User

func (*CallStateV2) RequestID

func (cs *CallStateV2) RequestID() string

func (*CallStateV2) RoutingTags

func (cs *CallStateV2) RoutingTags() *ge.CTXRoutingTags

func (*CallStateV2) SignedSession

func (cs *CallStateV2) SignedSession() *abp.SignedSession

func (*CallStateV2) User

func (cs *CallStateV2) User() *abp.User

type LocalCallState

type LocalCallState interface {
    User() *abp.User
    CallingService() *abp.User
    SignedSession() *abp.SignedSession
    RoutingTags() *ge.CTXRoutingTags
    RequestID() string
}

func NewCallStateV2

func NewCallStateV2(inctx *ge.InContext) LocalCallState