...

Source file src/golang.conradwood.net/go-easyops/rpc/contextv2.go

Documentation: golang.conradwood.net/go-easyops/rpc

     1  package rpc
     2  
     3  import (
     4  	abp "golang.conradwood.net/apis/auth"
     5  	ge "golang.conradwood.net/apis/goeasyops"
     6  	"golang.conradwood.net/go-easyops/common"
     7  )
     8  
     9  type LocalCallState interface {
    10  	User() *abp.User
    11  	CallingService() *abp.User
    12  	SignedSession() *abp.SignedSession
    13  	RoutingTags() *ge.CTXRoutingTags
    14  	RequestID() string
    15  }
    16  type CallStateV2 struct {
    17  	inCtx *ge.InContext
    18  }
    19  
    20  func NewCallStateV2(inctx *ge.InContext) LocalCallState {
    21  	return &CallStateV2{inCtx: inctx}
    22  }
    23  func (cs *CallStateV2) RequestID() string {
    24  	return "foorequestid"
    25  }
    26  func (cs *CallStateV2) User() *abp.User {
    27  	return common.VerifySignedUser(cs.inCtx.ImCtx.User)
    28  }
    29  func (cs *CallStateV2) CallingService() *abp.User {
    30  	return common.VerifySignedUser(cs.inCtx.MCtx.CallingService)
    31  }
    32  func (cs *CallStateV2) SignedSession() *abp.SignedSession {
    33  	return nil
    34  }
    35  func (cs *CallStateV2) RoutingTags() *ge.CTXRoutingTags {
    36  	return nil
    37  }
    38  

View as plain text