Documentation ¶
Index ¶
- Constants
- Variables
- func CanAccess(ctx *pb.ContextData, requiredAccess uint32, info string) bool
- func CreateNewContext(dbName string) *pb.ContextData
- func CreateNewLinkedContext(c *pb.ContextData, dbName string) *pb.ContextData
- func CtxLog(c *pb.ContextData, functionName string, message string, arg ...interface{})
- func CtxTrace(c *pb.ContextData, functionName string, level uint64, message string, ...)
- func GetAPIString(a API) string
- func GetEnv(key, fallback string, opt ...bool) string
- func GetInstance() string
- func GetMilliseconds(oldVal int64) int64
- func GetSecret(secretName string) interface{}
- func GetServiceString(svcID uint32) string
- func GetStringFromError(code codes.Code) string
- func IsCtxTraced(c *pb.ContextData, traceLevel uint64) bool
- func IsDesigner(ctx *pb.ContextData, info string) bool
- func IsErrorVisible(code codes.Code) bool
- func IsOwner(ctx *pb.ContextData, info string) bool
- func IsSvcMaskSet(svcMask uint64, sidToCheck uint8) bool
- func MakeSystemError(c *pb.ContextData, functionName string, err error, message string, ...) error
- func MakeSystemErrorAndPanic(c *pb.ContextData, functionName string, err error, message string, ...)
- func MakeUserError(c *pb.ContextData, functionName string, errNo uint16, level uint64, ...) error
- func NowAsUnixMilliseconds() int64
- func Ping() bool
- func ServiceFromString(strSvc string) uint32
- func WaitTimeout(wg *sync.WaitGroup, timeout time.Duration) bool
- func WriteLog(ctx *pb.ContextData, locationPath string, format string, arg ...interface{})
- func WriteTrace(ctx *pb.ContextData, location string, message string)
- type API
- type APIDef
- type ByteField
- type ByteFields
- type IDBStats
- type JByteDocument
- type JDbDocumentMap
- type JField
- type JFields
- type ServiceDef
Constants ¶
const ( ACCESSRead = 1 ACCESSInser = 2 ACCESSUpdate = 4 ACCESSDelete = 8 ACCESSFullRW = 15 ACCESSDesigner = 32 ACCESSOwner = 128 )
Access level contants
const ( ErrOK uint16 = 0 ErrNotFound uint16 = 1 ErrExist uint16 = 2 ErrAccessDenied uint16 = 3 ErrTimeOut uint16 = 4 ErrInvalidParam uint16 = 5 // error above 100 are server side error // and are hidden from the client ErrInternal uint16 = 32767 )
User Error Access level contants
const ( TypSrvDOCKER uint8 = 1 TypSrvKUBERNETES uint8 = 2 TypSrvISTIO uint8 = 3 TypSrvSIMPLEPROCESS uint8 = 4 )
Type Server
const ( TraceFatalError uint64 = 0 TraceSystemError uint64 = 1 TraceUserError uint64 = 2 TraceWarning uint64 = 4 TraceFunctionCalls uint64 = 8 TraceDenyAccess uint64 = 16 TraceAllowClientInfo uint64 = 32 // Service Specific TraceAll uint64 = 9223372036854775807 )
Tools Trace contants
const ( SVCUnknown uint32 = 0 SVCEcho uint32 = 1 SVCEntry uint32 = 2 SVCLogin uint32 = 3 SVCDbAPI uint32 = 4 SVCNotif uint32 = 5 )
ServiceID ...
Variables ¶
var APIDefinitions = map[API]APIDef{ APIUnknown: APIDef{"???", SVCUnknown}, APIHealth: APIDef{"Health", SVCUnknown}, APILOGINLOGIN: APIDef{"Login", SVCLogin}, APILOGINLOGOUT: APIDef{"Logout", SVCLogin}, API4: APIDef{"Api4", SVCUnknown}, API5: APIDef{"Api5", SVCUnknown}, API6: APIDef{"Api6", SVCUnknown}, APITestOK: APIDef{"Test_OK", SVCUnknown}, APITestError: APIDef{"TestErrorVisible", SVCUnknown}, APITestErrorNonVisible: APIDef{"TestErrorNonVisible", SVCUnknown}, APITokenRequired: APIDef{"ReservedAPI", SVCUnknown}, APITestPanic: APIDef{"Test_Panic", SVCUnknown}, APIDB_BEGIN: ApiDef{"Begin", SVCDbAPI}, APIDB_COMMIT: ApiDef{"Begin", SVCDbAPI}, APIDB_ROLLBACK: ApiDef{"Begin", SVCDbAPI}, APIDB_QUERY: ApiDef{"Begin", SVCDbAPI}, APIMax: APIDef{"InternalMaxApi", SVCUnknown}, }
APIDefinitions ...
var FLLockTimeOut = 5 * time.Second
LockTimeOut
var SvcDefinition = []ServiceDef{ {Server: "", ServiceID: SVCUnknown, ServiceName: "", Instance: "", Port: "", URL: ""}, {Server: "localhost", ServiceID: SVCEcho, ServiceName: "echo", Instance: "", Port: "1234", URL: ""}, {Server: "localhost", ServiceID: SVCEntry, ServiceName: "api", Instance: "prod", Port: "5001", URL: ""}, {Server: "localhost", ServiceID: SVCEntry, ServiceName: "api", Instance: "test", Port: "4001", URL: ""}, {Server: "localhost", ServiceID: SVCLogin, ServiceName: "login", Instance: "prod", Port: "5002", URL: ""}, {Server: "localhost", ServiceID: SVCLogin, ServiceName: "login", Instance: "test", Port: "4002", URL: ""}, {Server: "localhost", ServiceID: SVCDbAPI, ServiceName: "dbapi", Instance: "prod", Port: "5003", URL: ""}, {Server: "localhost", ServiceID: SVCDbAPI, ServiceName: "dbapi", Instance: "test", Port: "4003", URL: ""}, {Server: "localhost", ServiceID: SVCNotif, ServiceName: "svcnotification", Instance: "prod", Port: "5004", URL: ""}, {Server: "localhost", ServiceID: SVCNotif, ServiceName: "svcnotification", Instance: "test", Port: "4004", URL: ""}, }
SvcDefinition linked to the const def
var TypSrvString = map[string]uint8{ "DOCKER": TypSrvDOCKER, "KUBERNETES": TypSrvKUBERNETES, "ISTIO": TypSrvISTIO, "PROCESS": TypSrvSIMPLEPROCESS, }
TypSrvString decoding TypSrv
Functions ¶
func CanAccess ¶
func CanAccess(ctx *pb.ContextData, requiredAccess uint32, info string) bool
CanAccess ...
func CreateNewContext ¶ added in v0.4.43
func CreateNewContext(dbName string) *pb.ContextData
CreateNewContext ..
func CreateNewLinkedContext ¶ added in v0.5.8
func CreateNewLinkedContext(c *pb.ContextData, dbName string) *pb.ContextData
CreateNewLinkedContext ..
func CtxLog ¶ added in v0.5.8
func CtxLog(c *pb.ContextData, functionName string, message string, arg ...interface{})
CtxLog a message in the DTrace context
func CtxTrace ¶ added in v0.5.8
func CtxTrace(c *pb.ContextData, functionName string, level uint64, message string, arg ...interface{})
CtxTrace a message in the DTrace context
func GetStringFromError ¶ added in v0.4.21
GetStringFromError ..
func IsCtxTraced ¶ added in v0.5.22
func IsCtxTraced(c *pb.ContextData, traceLevel uint64) bool
func MakeSystemError ¶ added in v0.5.8
func MakeSystemError(c *pb.ContextData, functionName string, err error, message string, arg ...interface{}) error
MakeSystemError a message in the DTrace context
func MakeSystemErrorAndPanic ¶ added in v0.5.8
func MakeSystemErrorAndPanic(c *pb.ContextData, functionName string, err error, message string, arg ...interface{})
MakeSystemErrorAndPanic a message in the DTrace context
func MakeUserError ¶ added in v0.5.8
func MakeUserError(c *pb.ContextData, functionName string, errNo uint16, level uint64, message string, arg ...interface{}) error
MakeUserError a message in the DTrace context
func NowAsUnixMilliseconds ¶ added in v0.4.21
func NowAsUnixMilliseconds() int64
NowAsUnixMilliseconds ..
func WaitTimeout ¶ added in v0.4.21
WaitTimeout ...
func WriteLog ¶
func WriteLog(ctx *pb.ContextData, locationPath string, format string, arg ...interface{})
WriteLog ..
func WriteTrace ¶
func WriteTrace(ctx *pb.ContextData, location string, message string)
WriteTrace ...
Types ¶
type API ¶
type API uint8
API Our internal API type, and const
const ( APIUnknown API = 0 APIHealth API = 1 APILOGINLOGIN API = 2 APILOGINLOGOUT API = 3 API4 API = 4 API5 API = 5 API6 API = 6 APITestOK API = 7 APITestError API = 8 APITestErrorNonVisible API = 9 APITokenRequired API = 10 APITestPanic API = 11 APIDB_BEGIN API = 12 APIDB_COMMIT API = 13 APIDB_ROLLBACK API = 14 APIDB_QUERY API = 15 APIMax API = 16 )
List of known APIs
type APIDef ¶
type APIDef struct { ServiceID uint32 // contains filtered or unexported fields }
APIDef ...
type IDBStats ¶ added in v0.4.50
type IDBStats struct { MaxOpenConnections int // Maximum number of open connections to the database; added in Go 1.11 // Pool Status OpenConnections int // The number of established connections both in use and idle. InUse int // The number of connections currently in use; added in Go 1.11 Idle int // The number of idle connections; added in Go 1.11 // Counters WaitCount int64 // The total number of connections waited for; added in Go 1.11 WaitDuration time.Duration // The total time blocked waiting for a new connection; added in Go 1.11 MaxIdleClosed int64 // The total number of connections closed due to SetMaxIdleConns; added in Go 1.11 MaxLifetimeClosed int64 // The }
IDBStats ...
type JByteDocument ¶ added in v0.4.49
JByteDocument ...
type JDbDocumentMap ¶ added in v0.5.10
JDbDocumentMap struct to get our data id: uint64 json data, can be full/partial documents (projection)
func ConvertBytesDocToMap ¶ added in v0.5.10
func ConvertBytesDocToMap(docBytes *pb.DbDocumentBytes) (JDbDocumentMap, error)
ConvertBytesDocToMap ...
type ServiceDef ¶
type ServiceDef struct { Server string // Server, usually localhost ServiceID uint32 // ServiceID, only value used by apps ServiceName string // ServiceName for kubernetes, or printf Instance string // Instance. In Kubernetes need to be the same Port string // port number URL string // Self generated, url to use // contains filtered or unexported fields }
ServiceDef define the service
func GetServiceDefinition ¶
func GetServiceDefinition(sid uint32, instance ...string) ServiceDef
GetServiceDefinition ...
func GetServiceDefinitionByName ¶ added in v0.4.47
func GetServiceDefinitionByName(serviceName string, instance ...string) ServiceDef
GetServiceDefinitionByName ..
func (*ServiceDef) GetURL ¶
func (s *ServiceDef) GetURL() string
GetURL returns the url to connect to the serviceDef Dynamically regenerated