Documentation ¶
Overview ¶
Copyright (c) 2017-2018 Uber Technologies, Inc.
Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at
http://www.apache.org/licenses/LICENSE-2.0
Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
Index ¶
- Constants
- Variables
- func AddTableShardReporter(tableName string, shardID int)
- func AdjustOffset(fromOffset, toOffset int, switchTs, ts int64) int64
- func AlignOffset(offset int, alignment int) int
- func ApplyHTTPWrappers(handler http.HandlerFunc, wrappers []HTTPHandlerWrapper) http.HandlerFunc
- func BindEnvironments(v *viper.Viper)
- func BrokerServiceName(namespace string) string
- func CalculateDSTSwitchTs(fromTs, toTs int64, loc *time.Location) (switchTs int64, err error)
- func ComputeHLLValue(hash uint64) uint32
- func CrossDST(fromTs, toTs int64, loc *time.Location) bool
- func DataNodeServiceName(namespace string) string
- func DeleteTableShardReporter(tableName string, shardID int)
- func EnumNodeKey(namespace, table string, incarnation int, columnID, nodeID int) string
- func EnumNodeListKey(namespace, table string, incarnation, columnID int) string
- func FormatTimeStampToUTC(ts int64) string
- func GetConfig() common.AresServerConfig
- func GetFuncName(f interface{}) string
- func GetLogger() common.Logger
- func GetOrigin(r *http.Request) string
- func GetQueryLogger() common.Logger
- func GetTopicFromTable(namespace, table, suffix string) string
- func IndexOfInt(s []int, e int) int
- func IndexOfStr(strs []string, target string) int
- func Init(c common.AresServerConfig, l common.Logger, ql common.Logger, s tally.Scope)
- func InstanceKey(namespace, name string) string
- func InstanceListKey(namespace string) string
- func IsDev() bool
- func IsProd() bool
- func IsStaging() bool
- func IsTest() bool
- func JobAssignmentsKey(namespace, name string) string
- func JobAssignmentsListKey(namespace string) string
- func JobKey(namespace, name string) string
- func JobListKey(namespace string) string
- func LimitServe(port int, handler http.Handler, httpCfg common.HTTPConfig)
- func MemAccess(p unsafe.Pointer, offset int) unsafe.Pointer
- func MemCmp(a, b unsafe.Pointer, offset, bytes int) int
- func MemCopy(dst unsafe.Pointer, src unsafe.Pointer, bytes int)
- func MemDist(p1 unsafe.Pointer, p2 unsafe.Pointer) int64
- func MemEqual(a unsafe.Pointer, b unsafe.Pointer, bytes int) bool
- func MemSwap(dst unsafe.Pointer, src unsafe.Pointer, bytes int)
- func Murmur3Sum128(key unsafe.Pointer, bytes int, seed uint32) (out [2]uint64)
- func Murmur3Sum32(key unsafe.Pointer, bytes int, seed uint32) uint32
- func Murmur3Sum64(key unsafe.Pointer, bytes int, seed uint32) uint64
- func NamespaceKey(namespace string) string
- func NamespaceListKey() string
- func NoCache(h http.Handler) http.Handler
- func NoopHTTPWrapper(h http.HandlerFunc) http.HandlerFunc
- func NormalizeUUIDString(uuidStr string) (string, error)
- func Now() time.Time
- func RecoverWrap(call func() error) (err error)
- func ResetClockImplementation()
- func ResetDefaults()
- func SchemaKey(namespace, name string) string
- func SchemaListKey(namespace string) string
- func SetClockImplementation(f NowFunc)
- func SetCurrentTime(t time.Time)
- func SubscriberServiceName(namespace string) string
- func TimeStampToUTC(ts int64) time.Time
- func WithMetricsFunc(h http.HandlerFunc) http.HandlerFunc
- func WriteTable(dataSource TableDataSource) string
- type APIError
- type AresEnv
- type BufferReader
- func (b BufferReader) ReadFloat32(offset int) (float32, error)
- func (b BufferReader) ReadInt16(offset int) (int16, error)
- func (b BufferReader) ReadInt32(offset int) (int32, error)
- func (b BufferReader) ReadInt64(offset int) (int64, error)
- func (b BufferReader) ReadInt8(offset int) (int8, error)
- func (b BufferReader) ReadUint16(offset int) (uint16, error)
- func (b BufferReader) ReadUint32(offset int) (uint32, error)
- func (b BufferReader) ReadUint64(offset int) (uint64, error)
- func (b BufferReader) ReadUint8(offset int) (uint8, error)
- type BufferWriter
- func (b *BufferWriter) AlignBytes(alignment int)
- func (b *BufferWriter) Append(bs []byte) error
- func (b *BufferWriter) AppendBool(value bool) error
- func (b *BufferWriter) AppendFloat32(value float32) error
- func (b *BufferWriter) AppendInt16(value int16) error
- func (b *BufferWriter) AppendInt32(value int32) error
- func (b *BufferWriter) AppendInt64(value int64) error
- func (b *BufferWriter) AppendInt8(value int8) error
- func (b *BufferWriter) AppendUint16(value uint16) error
- func (b *BufferWriter) AppendUint32(value uint32) error
- func (b *BufferWriter) AppendUint64(value uint64) error
- func (b *BufferWriter) AppendUint8(value uint8) error
- func (b BufferWriter) GetOffset() int
- func (b *BufferWriter) SkipBits(bits int)
- func (b *BufferWriter) SkipBytes(bytes int)
- func (b *BufferWriter) Write(bs []byte) (int, error)
- func (b *BufferWriter) WriteAt(bs []byte, offset int64) (int, error)
- func (b *BufferWriter) WriteFloat32(value float32, offset int) error
- func (b *BufferWriter) WriteInt16(value int16, offset int) error
- func (b *BufferWriter) WriteInt32(value int32, offset int) error
- func (b *BufferWriter) WriteInt64(value int64, offset int) error
- func (b *BufferWriter) WriteInt8(value int8, offset int) error
- func (b *BufferWriter) WriteUint16(value uint16, offset int) error
- func (b *BufferWriter) WriteUint32(value uint32, offset int) error
- func (b *BufferWriter) WriteUint64(value uint64, offset int) error
- func (b *BufferWriter) WriteUint8(value uint8, offset int) error
- type ClosableBuffer
- type ClosableReader
- type EnvironmentContext
- type FileSystem
- type HTTPHandlerWrapper
- type Int64Array
- type MetricName
- type MetricType
- type NowFunc
- type OSFileSystem
- func (OSFileSystem) Mkdir(name string, perm os.FileMode) error
- func (OSFileSystem) MkdirAll(path string, perm os.FileMode) error
- func (OSFileSystem) OpenFileForWrite(name string, flag int, perm os.FileMode) (io.WriteCloser, error)
- func (OSFileSystem) ReadDir(dirname string) ([]os.FileInfo, error)
- func (OSFileSystem) ReadFile(name string) ([]byte, error)
- func (OSFileSystem) Remove(path string) error
- func (OSFileSystem) RemoveAll(path string) error
- func (OSFileSystem) Stat(path string) (os.FileInfo, error)
- type Options
- type RWLocker
- type ReaderSeekerCloser
- type Reporter
- func (r *Reporter) GetChildCounter(tags map[string]string, n MetricName) tally.Counter
- func (r *Reporter) GetChildGauge(tags map[string]string, n MetricName) tally.Gauge
- func (r *Reporter) GetChildTimer(tags map[string]string, n MetricName) tally.Timer
- func (r *Reporter) GetCounter(n MetricName) tally.Counter
- func (r *Reporter) GetGauge(n MetricName) tally.Gauge
- func (r *Reporter) GetRootScope() tally.Scope
- func (r *Reporter) GetTimer(n MetricName) tally.Timer
- type ReporterFactory
- type StackedError
- type StreamDataReader
- func (r StreamDataReader) GetBytesRead() uint32
- func (r *StreamDataReader) Read(bs []byte) error
- func (r *StreamDataReader) ReadFloat32() (float32, error)
- func (r *StreamDataReader) ReadInt16() (int16, error)
- func (r *StreamDataReader) ReadInt32() (int32, error)
- func (r *StreamDataReader) ReadInt8() (int8, error)
- func (r *StreamDataReader) ReadPadding(nbytes int, alignment int) error
- func (r *StreamDataReader) ReadUint16() (uint16, error)
- func (r *StreamDataReader) ReadUint32() (uint32, error)
- func (r *StreamDataReader) ReadUint64() (uint64, error)
- func (r *StreamDataReader) ReadUint8() (uint8, error)
- func (r *StreamDataReader) SkipBytes(nbytes int) error
- type StreamDataWriter
- func (w StreamDataWriter) GetBytesWritten() uint32
- func (w *StreamDataWriter) SkipBytes(nbytes int) error
- func (w *StreamDataWriter) Write(bs []byte) error
- func (w *StreamDataWriter) WriteFloat32(v float32) error
- func (w *StreamDataWriter) WriteInt16(v int16) error
- func (w *StreamDataWriter) WriteInt32(v int32) error
- func (w *StreamDataWriter) WriteInt8(v int8) error
- func (w *StreamDataWriter) WritePadding(nbytes int, alignment int) error
- func (w *StreamDataWriter) WriteUint16(v uint16) error
- func (w *StreamDataWriter) WriteUint32(v uint32) error
- func (w *StreamDataWriter) WriteUint64(v uint64) error
- func (w *StreamDataWriter) WriteUint8(v uint8) error
- type TableDataSource
- type TestingTMock
- type TimeIncrementer
- type Uint32Array
Constants ¶
const ( EnvProd AresEnv = "production" EnvStaging AresEnv = "staging" EnvDev AresEnv = "development" EnvTest AresEnv = "test" EnvironmentKey = "ENVIRONMENT" RuntimeEnvironmentKey = "RUNTIME_ENVIRONMENT" ZoneKey = "DATACENTER_ZONE" DeploymentKey = "DEPLOYMENT_NAME" HostnameKey = "HOSTNAME" PortSystemKey = "PORT_SYSTEM" AppIDKey = "APP_ID" InstanceIDKey = "INSTANCE_ID" )
const ( HTTPContentTypeHeaderKey = "content-type" HTTPAcceptTypeHeaderKey = "accept" HTTPContentTypeApplicationJson = "application/json" HTTPContentTypeApplicationGRPC = "application/grpc" // HTTPContentTypeUpsertBatch defines the upsert data content type. HTTPContentTypeUpsertBatch = "application/upsert-data" // HTTPContentTypeHyperLogLog defines the hyperloglog query result content type. HTTPContentTypeHyperLogLog = "application/hll" )
const ( // AresController sets the name for ares controller AresController = "ares-controller" // AresSubscriber sets the name for ares subscriber AresSubscriber = "ares-subscriber" // AresDataNode sets the name for ares datanode AresDataNode = "ares-datanode" // AresBroker sets the name for ares broker AresBroker = "ares-broker" )
const ( // GolangMemoryFootprintFactor is a rough estimation of the factor // of memory occupied by golang against application live data set // (memory occupied by application objects). GolangMemoryFootprintFactor = 2 )
Variables ¶
var ( // TestingT is the global singleton for TestingTMock. TestingT = &TestingTMock{} )
Functions ¶
func AddTableShardReporter ¶
AddTableShardReporter adds a reporter for the given table and shards. It should be called when bootstrap the table shards or shard ownership changes.
func AdjustOffset ¶
AdjustOffset adjusts timestamp value with time range start or end ts basing on DST switch ts
func AlignOffset ¶
AlignOffset returns the next offset given a specific alignment.
func ApplyHTTPWrappers ¶
func ApplyHTTPWrappers(handler http.HandlerFunc, wrappers []HTTPHandlerWrapper) http.HandlerFunc
ApplyHTTPWrappers apply wrappers according to the order
func BindEnvironments ¶ added in v0.0.2
BindEnvironments binds environment variables to viper
func BrokerServiceName ¶ added in v0.0.2
BrokerServiceName builds the broker service name
func CalculateDSTSwitchTs ¶
CalculateDSTSwitchTs calculates DST switch timestamp given a time range and a timezone it returns 0 if given range doesn't contain a switch for that zone it assumes the range won't contain more than 1 switch timestamp, otherwise it will return one of them (which one to return is not determined)
func ComputeHLLValue ¶ added in v0.0.2
ComputeHLLValue compute hll value based on hash value
func DataNodeServiceName ¶ added in v0.0.2
DataNodeServiceName builds the data node service name
func DeleteTableShardReporter ¶
DeleteTableShardReporter deletes the reporter for the given table and shards. It should be called when the table shard no longer belongs to current node.
func EnumNodeKey ¶ added in v0.0.2
EnumNodeKey builds the key for enum node
func EnumNodeListKey ¶ added in v0.0.2
EnumNodeListKey builds the key for enum node list
func FormatTimeStampToUTC ¶
FormatTimeStampToUTC formats a epoch timestamp to a time string in UTC time zone.
func GetFuncName ¶
func GetFuncName(f interface{}) string
GetFuncName returns the function name given a function pointer. It will only return the last part of the name.
func GetQueryLogger ¶
GetQueryLogger returns the logger for query.
func GetTopicFromTable ¶ added in v0.0.2
GetTopicFromTable get the topic name for namespace and table name
func IndexOfInt ¶
IndexOfInt finds the index of a target int inside a slice of ints, return -1 if not found
func IndexOfStr ¶
IndexOfStr finds the index of a target string inside a slice of strings, return -1 if not found
func InstanceKey ¶ added in v0.0.2
InstanceKey builds key for instance
func InstanceListKey ¶ added in v0.0.2
InstanceListKey builds key for job assignments
func JobAssignmentsKey ¶ added in v0.0.2
JobAssignmentsKey builds key for job assignments
func JobAssignmentsListKey ¶ added in v0.0.2
JobAssignmentsListKey builds key for job assignments
func JobListKey ¶ added in v0.0.2
JobListKey builds key for job list
func LimitServe ¶
func LimitServe(port int, handler http.Handler, httpCfg common.HTTPConfig)
LimitServe will start a http server on the port with the handler and at most maxConnection concurrent connections.
func MemAccess ¶ added in v0.0.2
MemAccess access memory location with starting pointer and an offset.
func MemCmp ¶ added in v0.0.2
MemCmp performs memory comparison between two memory location start from offset comparing bytes byte while skip offset byte
func Murmur3Sum128 ¶ added in v0.0.2
Murmur3Sum128 implements murmur3sum128 hash algorithm
func Murmur3Sum32 ¶
Murmur3Sum32 implements Murmur3Sum32 hash algorithm
func Murmur3Sum64 ¶ added in v0.0.2
Murmur3Sum64 use Murmur3Sum128 to generate 64bit hash
func NamespaceKey ¶ added in v0.0.2
NamespaceKey builds key for namespace
func NamespaceListKey ¶ added in v0.0.2
func NamespaceListKey() string
NamespaceListKey builds key for namespace list
func NoopHTTPWrapper ¶
func NoopHTTPWrapper(h http.HandlerFunc) http.HandlerFunc
NoopHTTPWrapper does nothing; used for testing
func NormalizeUUIDString ¶
NormalizeUUIDString normailizes a uuid string by applying following rules. If it's not a valid uuid str, it will raise an error. 1. remove 0x prefix if any 2. convert to uppercase 3. remove -
func RecoverWrap ¶
RecoverWrap recover all panics inside the passed in func
func ResetClockImplementation ¶
func ResetClockImplementation()
ResetClockImplementation resets implementation to use time.Now
func ResetDefaults ¶ added in v0.0.2
func ResetDefaults()
ResetDefaults reset default config, logger and metrics settings
func SchemaListKey ¶ added in v0.0.2
SchemaListKey builds key for schema list
func SetClockImplementation ¶
func SetClockImplementation(f NowFunc)
SetClockImplementation sets implementation to use passed in nowFunc
func SetCurrentTime ¶
SetCurrentTime sets the clock implementation to the specified time,
func SubscriberServiceName ¶ added in v0.0.2
SubscriberServiceName builds the subscriber service name
func TimeStampToUTC ¶
TimeStampToUTC converts a timestamp to a Time struct in UTC time zone.
func WithMetricsFunc ¶
func WithMetricsFunc(h http.HandlerFunc) http.HandlerFunc
WithMetricsFunc will send stats like latency, rps and returning status code after the http handler finishes. It has to be applied to the actual handler function who serves the http request.
func WriteTable ¶
func WriteTable(dataSource TableDataSource) string
WriteTable renders a tabular representation from underlying data source. If there is no column for this data source, it will return an empty string. All elements of the table will be right justify (left padding). Column splitter is "|" for now.
Types ¶
type APIError ¶
type APIError struct { Code int `json:"-"` Message string `json:"message"` Cause error `json:"cause"` }
APIError represents APIError with error code
type AresEnv ¶
type AresEnv string
func GetAresEnv ¶
func GetAresEnv() AresEnv
GetAresEnv gets the running environment setting for ares
type BufferReader ¶
type BufferReader struct {
// contains filtered or unexported fields
}
BufferReader provides read function for different type to read from the underline buffer.
func NewBufferReader ¶
func NewBufferReader(buffer []byte) BufferReader
NewBufferReader creates a BufferReader.
func (BufferReader) ReadFloat32 ¶
func (b BufferReader) ReadFloat32(offset int) (float32, error)
ReadFloat32 reads 4 bytes from buffer.
func (BufferReader) ReadInt16 ¶
func (b BufferReader) ReadInt16(offset int) (int16, error)
ReadInt16 reads 2 bytes from buffer.
func (BufferReader) ReadInt32 ¶
func (b BufferReader) ReadInt32(offset int) (int32, error)
ReadInt32 reads 4 bytes from buffer.
func (BufferReader) ReadInt64 ¶ added in v0.0.2
func (b BufferReader) ReadInt64(offset int) (int64, error)
ReadInt64 reads 8 bytes from buffer.
func (BufferReader) ReadInt8 ¶
func (b BufferReader) ReadInt8(offset int) (int8, error)
ReadInt8 reads 1 byte from buffer.
func (BufferReader) ReadUint16 ¶
func (b BufferReader) ReadUint16(offset int) (uint16, error)
ReadUint16 reads 2 bytes from buffer.
func (BufferReader) ReadUint32 ¶
func (b BufferReader) ReadUint32(offset int) (uint32, error)
ReadUint32 reads 4 bytes from buffer.
func (BufferReader) ReadUint64 ¶
func (b BufferReader) ReadUint64(offset int) (uint64, error)
ReadUint64 reads 8 bytes from buffer.
type BufferWriter ¶
type BufferWriter struct {
// contains filtered or unexported fields
}
BufferWriter provides functions to write different data types into the underline buffer. It supports both random access and sequential access.
func NewBufferWriter ¶
func NewBufferWriter(buffer []byte) BufferWriter
NewBufferWriter creates a new buffer writer over a buffer.
func (*BufferWriter) AlignBytes ¶
func (b *BufferWriter) AlignBytes(alignment int)
AlignBytes aligns the offset/bit offset to the next byte specified in alignment. The new offset may cross the buffer boundary.
func (*BufferWriter) Append ¶
func (b *BufferWriter) Append(bs []byte) error
Append writes a byte slice to buffer and advances offset.
func (*BufferWriter) AppendBool ¶
func (b *BufferWriter) AppendBool(value bool) error
AppendBool append a boolean value to buffer and advances byte/bit offset.
func (*BufferWriter) AppendFloat32 ¶
func (b *BufferWriter) AppendFloat32(value float32) error
AppendFloat32 writes a float32 value to buffer and advances offset.
func (*BufferWriter) AppendInt16 ¶
func (b *BufferWriter) AppendInt16(value int16) error
AppendInt16 writes a int16 value to buffer and advances offset.
func (*BufferWriter) AppendInt32 ¶
func (b *BufferWriter) AppendInt32(value int32) error
AppendInt32 writes a int32 value to buffer and advances offset.
func (*BufferWriter) AppendInt64 ¶
func (b *BufferWriter) AppendInt64(value int64) error
AppendInt64 writes a int64 value to buffer and advances offset.
func (*BufferWriter) AppendInt8 ¶
func (b *BufferWriter) AppendInt8(value int8) error
AppendInt8 writes a int8 value to buffer and advances offset.
func (*BufferWriter) AppendUint16 ¶
func (b *BufferWriter) AppendUint16(value uint16) error
AppendUint16 writes a uint16 value to buffer and advances offset.
func (*BufferWriter) AppendUint32 ¶
func (b *BufferWriter) AppendUint32(value uint32) error
AppendUint32 writes a uint32 value to buffer and advances offset.
func (*BufferWriter) AppendUint64 ¶
func (b *BufferWriter) AppendUint64(value uint64) error
AppendUint64 writes a uint64 value to buffer and advances offset.
func (*BufferWriter) AppendUint8 ¶
func (b *BufferWriter) AppendUint8(value uint8) error
AppendUint8 writes a uint8 value to buffer and advances offset.
func (BufferWriter) GetOffset ¶
func (b BufferWriter) GetOffset() int
GetOffset returns the current offset value.
func (*BufferWriter) SkipBits ¶
func (b *BufferWriter) SkipBits(bits int)
SkipBits moves the bit offset and possibly byte offset. The new offset may cross the buffer boundary.
func (*BufferWriter) SkipBytes ¶
func (b *BufferWriter) SkipBytes(bytes int)
SkipBytes moves the underline offset by specified bytes. The new offset may cross the buffer boundary.
func (*BufferWriter) Write ¶
func (b *BufferWriter) Write(bs []byte) (int, error)
Write implements Write in io.Writer interface
func (*BufferWriter) WriteAt ¶
func (b *BufferWriter) WriteAt(bs []byte, offset int64) (int, error)
WriteAt implements WriteAt in io.WriterAt interface
func (*BufferWriter) WriteFloat32 ¶
func (b *BufferWriter) WriteFloat32(value float32, offset int) error
WriteFloat32 writes a float32 value to buffer and advances offset.
func (*BufferWriter) WriteInt16 ¶
func (b *BufferWriter) WriteInt16(value int16, offset int) error
WriteInt16 writes a int16 value to buffer and advances offset.
func (*BufferWriter) WriteInt32 ¶
func (b *BufferWriter) WriteInt32(value int32, offset int) error
WriteInt32 writes a int32 value to buffer and advances offset.
func (*BufferWriter) WriteInt64 ¶
func (b *BufferWriter) WriteInt64(value int64, offset int) error
WriteInt64 writes a int64 value to buffer and advances offset.
func (*BufferWriter) WriteInt8 ¶
func (b *BufferWriter) WriteInt8(value int8, offset int) error
WriteInt8 writes a int8 value to buffer at given offset.
func (*BufferWriter) WriteUint16 ¶
func (b *BufferWriter) WriteUint16(value uint16, offset int) error
WriteUint16 writes a uint16 value to buffer and advances offset.
func (*BufferWriter) WriteUint32 ¶
func (b *BufferWriter) WriteUint32(value uint32, offset int) error
WriteUint32 writes a uint32 value to buffer and advances offset.
func (*BufferWriter) WriteUint64 ¶
func (b *BufferWriter) WriteUint64(value uint64, offset int) error
WriteUint64 writes a uint64 value to buffer and advances offset.
func (*BufferWriter) WriteUint8 ¶
func (b *BufferWriter) WriteUint8(value uint8, offset int) error
WriteUint8 writes a uint8 value to buffer and advances offset.
type ClosableBuffer ¶
ClosableBuffer is not really closable but just implements the io.WriteCloser interface.
func (*ClosableBuffer) Close ¶
func (cb *ClosableBuffer) Close() error
Close just implements Close function of io.WriteCloser interface.
type ClosableReader ¶
ClosableReader is not really closable but just implements the io.ReadCloser interface.
func (*ClosableReader) Close ¶
func (cr *ClosableReader) Close() error
Close just implements Close function of io.ReadCloser interface.
type EnvironmentContext ¶ added in v0.0.2
type EnvironmentContext struct { // Environment is // enum for host-level environment (development, test, production, staging) Environment string // RuntimeEnvironment is user-specified service runtime environment RuntimeEnvironment string // Zone is data center Zone string // Hostname is the host name Hostname string // Deployment is the deployment name Deployment string // t.uber.com/udeploy_env // SystemPort is for health checks and introspection SystemPort string // ApplicationID is application name ApplicationID string // InstanceID is the ID of an application instance InstanceID string }
type FileSystem ¶
type FileSystem interface { ReadFile(filename string) ([]byte, error) ReadDir(dirname string) ([]os.FileInfo, error) Stat(path string) (os.FileInfo, error) Mkdir(name string, perm os.FileMode) error MkdirAll(path string, perm os.FileMode) error Remove(path string) error RemoveAll(path string) error OpenFileForWrite(name string, flag int, perm os.FileMode) (io.WriteCloser, error) }
FileSystem is a file system interface
type HTTPHandlerWrapper ¶
type HTTPHandlerWrapper func(handler http.HandlerFunc) http.HandlerFunc
HTTPHandlerWrapper wraps context aware httpHandler
type Int64Array ¶
type Int64Array []int64
Int64Array is the holder object for []int64 and implementations for Sort interfaces.
func (Int64Array) Len ¶
func (s Int64Array) Len() int
func (Int64Array) Less ¶
func (s Int64Array) Less(i, j int) bool
func (Int64Array) Swap ¶
func (s Int64Array) Swap(i, j int)
type MetricName ¶
type MetricName int
MetricName is the type of the metric.
const ( // DataNode metrics AllocatedDeviceMemory MetricName = iota AppendedRecords ArchivingCount ArchivingHighWatermark ArchivingIgnoredRecords ArchivingLowWatermark ArchivingRecords ArchivingTimingTotal BackfillAffectedDays BackfillBufferFillRatio BackfillBufferNumRecords BackfillBufferSize BackfillCount BackfillDeleteThenInsertRecords BackfillInplaceUpdateRecords BackfillLockTiming BackfillNewRecords BackfillNoEffectRecords BackfillRecords BackfillRecordsColumnRemoved BackfillRecordsRatio BackfillRecordsTimeDifference BackfillTimingTotal BatchSize BatchSizeReportTime CurrentRedologCreationTime CurrentRedologSize DuplicateRecordRatio EstimatedDeviceMemory HTTPHandlerCall HTTPHandlerLatency IngestSkippedRecords IngestedErrorBatches IngestedRecords IngestedRecoveryBatches IngestedUpsertBatches IngestionLagPerColumn JobFailuresCount ManagedMemorySize MemoryOverflow NumberOfEnumCasesPerColumn NumberOfRedologs PreloadingZoneEvicted PrimaryKeyMissing PurgeCount PurgeTimingTotal PurgedBatches QueryArchiveBatchProcessed QueryArchiveBytesTransferred QueryArchiveRecordsProcessed QueryDimReadLatency QueryFailed QueryLatency QueryLiveBatchProcessed QueryLiveBytesTransferred QueryLiveRecordsProcessed QueryReceived QueryRowsReturned QuerySQLParsingLatency QuerySucceeded QueryWaitForMemoryDuration RawVPBytesFetched RawVPFetchBytesPerSec RawVPFetchFailure RawVPFetchSuccess RawVPFetchTime RecordsFromFuture RecordsOutOfRetention RecoveryIgnoredRecords RecoveryIgnoredRecordsTimeDifference RecoveryLatency RecoveryUpsertBatchSize RedoLogFileCorrupt SchemaCreationCount SchemaDeletionCount SchemaFetchFailure SchemaFetchFailureEnum SchemaFetchSuccess SchemaUpdateCount SizeOfRedologs SnapshotCount SnapshotTimingBuildIndex SnapshotTimingLoad SnapshotTimingTotal TimeColumnMissing TimezoneLookupTableCreationTime TotalMemorySize TotalRawVPFetchTime UnmanagedMemorySize UpdatedRecords UpsertBatchSize // Broker metrics AQLQueryReceivedBroker SQLQueryReceivedBroker QueryFailedBroker QuerySucceededBroker QueryLatencyBroker SQLParsingLatencyBroker QueryPlanExecuteFailures DataNodeQueryFailures TimeWaitedForDataNode TimeSerDeDataNodeResponse MetricNamesSentinel )
List of supported metric names.
type MetricType ¶
type MetricType int
MetricType is the supported metric type.
const ( Counter MetricType = iota Gauge Timer )
MetricTypes which are supported.
type OSFileSystem ¶
type OSFileSystem struct{}
OSFileSystem implements FileSystem using os package
func (OSFileSystem) Mkdir ¶
func (OSFileSystem) Mkdir(name string, perm os.FileMode) error
Mkdir makes directory with given name and permission
func (OSFileSystem) MkdirAll ¶
func (OSFileSystem) MkdirAll(path string, perm os.FileMode) error
MkdirAll makes directory with necessary parent directories in path
func (OSFileSystem) OpenFileForWrite ¶
func (OSFileSystem) OpenFileForWrite(name string, flag int, perm os.FileMode) (io.WriteCloser, error)
OpenFileForWrite opens a file for write
func (OSFileSystem) ReadDir ¶
func (OSFileSystem) ReadDir(dirname string) ([]os.FileInfo, error)
ReadDir reads file infos under given directory
func (OSFileSystem) ReadFile ¶
func (OSFileSystem) ReadFile(name string) ([]byte, error)
ReadFile reads whole file into byte buffer
func (OSFileSystem) RemoveAll ¶
func (OSFileSystem) RemoveAll(path string) error
RemoveAll removes a file and all its children
type Options ¶ added in v0.0.2
type Options interface { // Logger returns the logger Logger() common.Logger // MetricsScope returns the metrics scope. MetricsScope() tally.Scope // SetMetricsSamplingRate sets the metrics sampling rate. SetMetricsSamplingRate(value float64) Options // SetMetricsSamplingRate returns the metrics sampling rate. MetricsSamplingRate() float64 }
Options represents the options for instrumentation.
func NewOptions ¶ added in v0.0.2
func NewOptions() Options
NewOptions creates new instrument options.
type ReaderSeekerCloser ¶
ReaderSeekerCloser represents the interface that we can read, seek and close an io stream. We have define our own since there is no go built-in interface fot this.
type Reporter ¶
type Reporter struct {
// contains filtered or unexported fields
}
Reporter is the the interface used to report stats,
func GetReporter ¶
GetReporter returns reporter given tableName and shardID. If the corresponding reporter cannot be found. It will return the root scope.
func GetRootReporter ¶
func GetRootReporter() *Reporter
GetRootReporter returns the root metrics reporter.
func NewReporter ¶
NewReporter returns a new reporter with supplied root scope.
func (*Reporter) GetChildCounter ¶
GetChildCounter create tagged child counter from reporter
func (*Reporter) GetChildGauge ¶
GetChildGauge create tagged child gauge from reporter
func (*Reporter) GetChildTimer ¶
GetChildTimer create tagged child timer from reporter
func (*Reporter) GetCounter ¶
func (r *Reporter) GetCounter(n MetricName) tally.Counter
GetCounter returns the tally counter with corresponding tags.
func (*Reporter) GetGauge ¶
func (r *Reporter) GetGauge(n MetricName) tally.Gauge
GetGauge returns the tally gauge with corresponding tags.
func (*Reporter) GetRootScope ¶
GetRootScope returns the root scope wrapped by this reporter.
type ReporterFactory ¶
ReporterFactory manages reporters for different table and shards. If the corresponding metrics are not associated with any table or shard. It can use the root reporter.
func NewReporterFactory ¶
func NewReporterFactory(rootScope tally.Scope) *ReporterFactory
NewReporterFactory returns a new report factory.
func (*ReporterFactory) AddTableShard ¶
func (f *ReporterFactory) AddTableShard(tableName string, shardID int)
AddTableShard adds a reporter for the given table and shards. It should be called when bootstrap the table shards or shard ownership changes.
func (*ReporterFactory) DeleteTableShard ¶
func (f *ReporterFactory) DeleteTableShard(tableName string, shardID int)
DeleteTableShard deletes the reporter for the given table and shards. It should be called when the table shard no longer belongs to current node.
func (*ReporterFactory) GetReporter ¶
func (f *ReporterFactory) GetReporter(tableName string, shardID int) *Reporter
GetReporter returns reporter given tableName and shardID. If the corresponding reporter cannot be found. It will return the root scope.
func (*ReporterFactory) GetRootReporter ¶
func (f *ReporterFactory) GetRootReporter() *Reporter
GetRootReporter returns the root reporter.
type StackedError ¶
StackedError contains multiple lines of error messages as well as the stack trace.
func StackError ¶
func StackError(err error, message string, args ...interface{}) *StackedError
StackError adds one more line of message to err. It updates err if it's already a StackedError, otherwise creates a new StackedError with the message from err and the stack trace of current goroutine.
func (*StackedError) Error ¶
func (e *StackedError) Error() string
type StreamDataReader ¶
type StreamDataReader struct {
// contains filtered or unexported fields
}
StreamDataReader reads primitive Golang data types from an underlying reader. It always advance the read iterator without rewinding it.
func NewStreamDataReader ¶
func NewStreamDataReader(reader io.Reader) StreamDataReader
NewStreamDataReader returns a StreamDataReader given an underlying reader.
func (StreamDataReader) GetBytesRead ¶
func (r StreamDataReader) GetBytesRead() uint32
GetBytesRead returns number of bytes read so far.
func (*StreamDataReader) Read ¶
func (r *StreamDataReader) Read(bs []byte) error
Read reads bytes from underlying reader and fill bs with len(bs) bytes data. Raise error if there is no enough bytes left.
func (*StreamDataReader) ReadFloat32 ¶
func (r *StreamDataReader) ReadFloat32() (float32, error)
ReadFloat32 reads one float32 from the reader and advance.
func (*StreamDataReader) ReadInt16 ¶
func (r *StreamDataReader) ReadInt16() (int16, error)
ReadInt16 reads one int16 from the reader and advance.
func (*StreamDataReader) ReadInt32 ¶
func (r *StreamDataReader) ReadInt32() (int32, error)
ReadInt32 reads one int32 from the reader and advance.
func (*StreamDataReader) ReadInt8 ¶
func (r *StreamDataReader) ReadInt8() (int8, error)
ReadInt8 reads one int8 from the reader and advance.
func (*StreamDataReader) ReadPadding ¶
func (r *StreamDataReader) ReadPadding(nbytes int, alignment int) error
ReadPadding reads and ignore bytes until alignment is met. nbytes is the size of bytes already read.
func (*StreamDataReader) ReadUint16 ¶
func (r *StreamDataReader) ReadUint16() (uint16, error)
ReadUint16 reads one uint16 from the reader and advance.
func (*StreamDataReader) ReadUint32 ¶
func (r *StreamDataReader) ReadUint32() (uint32, error)
ReadUint32 reads one uint32 from the reader and advance.
func (*StreamDataReader) ReadUint64 ¶
func (r *StreamDataReader) ReadUint64() (uint64, error)
ReadUint64 reads one uint64 from the reader and advance.
func (*StreamDataReader) ReadUint8 ¶
func (r *StreamDataReader) ReadUint8() (uint8, error)
ReadUint8 reads one uint8 from the reader and advance.
func (*StreamDataReader) SkipBytes ¶
func (r *StreamDataReader) SkipBytes(nbytes int) error
SkipBytes read some empty bytes from the reader and discard it
type StreamDataWriter ¶
type StreamDataWriter struct {
// contains filtered or unexported fields
}
StreamDataWriter writes primitive Golang data types to an underlying writer. It always advance the write iterator without rewinding it.
func NewStreamDataWriter ¶
func NewStreamDataWriter(writer io.Writer) StreamDataWriter
NewStreamDataWriter returns a StreamDataWriter given an underlying writer.
func (StreamDataWriter) GetBytesWritten ¶
func (w StreamDataWriter) GetBytesWritten() uint32
GetBytesWritten returns number of bytes written by current writer so far.
func (*StreamDataWriter) SkipBytes ¶
func (w *StreamDataWriter) SkipBytes(nbytes int) error
SkipBytes write some empty bytes to the writer and advance.
func (*StreamDataWriter) Write ¶
func (w *StreamDataWriter) Write(bs []byte) error
func (*StreamDataWriter) WriteFloat32 ¶
func (w *StreamDataWriter) WriteFloat32(v float32) error
WriteFloat32 writes one float32 to the writer and advance.
func (*StreamDataWriter) WriteInt16 ¶
func (w *StreamDataWriter) WriteInt16(v int16) error
WriteInt16 writes one int16 to the writer and advance.
func (*StreamDataWriter) WriteInt32 ¶
func (w *StreamDataWriter) WriteInt32(v int32) error
WriteInt32 writes one int32 to the writer and advance.
func (*StreamDataWriter) WriteInt8 ¶
func (w *StreamDataWriter) WriteInt8(v int8) error
WriteInt8 writes one int8 to the writer and advance.
func (*StreamDataWriter) WritePadding ¶
func (w *StreamDataWriter) WritePadding(nbytes int, alignment int) error
WritePadding write some empty bytes until alignment is met. nbytes is the size of bytes already written.
func (*StreamDataWriter) WriteUint16 ¶
func (w *StreamDataWriter) WriteUint16(v uint16) error
WriteUint16 writes one uint16 to the writer and advance.
func (*StreamDataWriter) WriteUint32 ¶
func (w *StreamDataWriter) WriteUint32(v uint32) error
WriteUint32 writes one uint32 to the writer and advance.
func (*StreamDataWriter) WriteUint64 ¶
func (w *StreamDataWriter) WriteUint64(v uint64) error
WriteUint64 writes one uint64 to the writer and advance.
func (*StreamDataWriter) WriteUint8 ¶
func (w *StreamDataWriter) WriteUint8(v uint8) error
WriteUint8 writes one uint8 to the writer and advance.
type TableDataSource ¶
type TableDataSource interface { NumRows() int GetValue(row, col int) interface{} ColumnHeaders() []string }
TableDataSource defines the interface a data source need to implement so that we can render a tabular representation from the data source. We get number of columns from the length of column header. the data source itself should ensure that for each get value call with row and col within [0,numRows) and [0, numCols), it should return valid value and should not panic.
type TestingTMock ¶
type TestingTMock struct { }
TestingTMock is the mock class for testingT used in mockery.
func (*TestingTMock) Errorf ¶
func (*TestingTMock) Errorf(format string, args ...interface{})
Errorf is the implementation of mockery.testingT interface.
func (*TestingTMock) FailNow ¶
func (*TestingTMock) FailNow()
FailNow is the implementation of mockery.testingT interface.
func (*TestingTMock) Fatalf ¶ added in v0.0.2
func (*TestingTMock) Fatalf(format string, args ...interface{})
func (*TestingTMock) Logf ¶
func (*TestingTMock) Logf(format string, args ...interface{})
Logf is the implementation of mockery.testingT interface.
type TimeIncrementer ¶
type TimeIncrementer struct { IncBySecond int64 // contains filtered or unexported fields }
TimeIncrementer increment current time by configurable incremental
func (*TimeIncrementer) Now ¶
func (r *TimeIncrementer) Now() time.Time
Now increment current time by one second at a time
type Uint32Array ¶
type Uint32Array []uint32
Uint32Array is the holder object for []uint32 and implementations for Sort interfaces.
func (Uint32Array) Len ¶
func (s Uint32Array) Len() int
func (Uint32Array) Less ¶
func (s Uint32Array) Less(i, j int) bool
func (Uint32Array) Swap ¶
func (s Uint32Array) Swap(i, j int)
Source Files ¶
Directories ¶
Path | Synopsis |
---|---|
Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Package mocks is generated by mockery v1.0.0 Package mocks generated by mockery v1.0.0
|
Code generated by mockery v1.0.0 Code generated by mockery v1.0.0 Package mocks is generated by mockery v1.0.0 Package mocks generated by mockery v1.0.0 |