const (
LOCALCONTEXTNAME = "GOEASYOPS_LOCALCTX"
LOCALCONTEXTNAMEV2 = "GOEASYOPS_LOCALCTX_V2"
// timeout for newly created context in this package
DEFAULT_TIMEOUT_SECS = 10
)
func EnableDebug(ctx context.Context)
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(ctx context.Context) *CallState
func ContextWithCallState(ctx context.Context) (context.Context, *CallState)
func (cs *CallState) CallerService() *auth.User
return the authenticated service
func (cs *CallState) CallerString() string
func (cs *CallState) DISMetadataValue() string
func (cs *CallState) DebugPrintContext()
print context (if debug enabled)
func (c *CallState) IsV2() bool
func (cs *CallState) PrintContext()
func (cs *CallState) RequestID() string
func (cs *CallState) RoutingTags() *ge.CTXRoutingTags
func (c *CallState) SetV2(lcs LocalCallState)
this now is a "V2" style callstate
func (cs *CallState) SignedService() *auth.SignedUser
func (cs *CallState) SignedSession() *auth.SignedSession
func (cs *CallState) SignedUser() *auth.SignedUser
func (cs *CallState) TargetString() string
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 (cs *CallState) UpdateContextFromResponseWithTimeout(t time.Duration) error
func (cs *CallState) User() *auth.User
return the authenticated user
type CallStateV2 struct {
// contains filtered or unexported fields
}
func (cs *CallStateV2) CallingService() *abp.User
func (cs *CallStateV2) RequestID() string
func (cs *CallStateV2) RoutingTags() *ge.CTXRoutingTags
func (cs *CallStateV2) SignedSession() *abp.SignedSession
func (cs *CallStateV2) User() *abp.User
type LocalCallState interface {
User() *abp.User
CallingService() *abp.User
SignedSession() *abp.SignedSession
RoutingTags() *ge.CTXRoutingTags
RequestID() string
}
func NewCallStateV2(inctx *ge.InContext) LocalCallState