Documentation ¶
Overview ¶
Package utils contains all the utilites used across the repo
Index ¶
- func AckTrimStreamSegment(redisClient *redis.Client, segmentLength int, streamKey, consumerGroup string, ...) (int64, error)
- func DecodeAvro(record avro.AvroRecord, buffer []byte) error
- func EncodeAvro(record avro.AvroRecord) ([]byte, error)
- func ExpandPath(fsPath string) string
- func GetConfig(fs *flag.FlagSet) []string
- func GetLogLocationURL(logPath string) (*url.URL, error)
- func HomeDir() string
- func NewEthClient(address string) (*ethclient.Client, error)
- func NewGCPStorageClient(serviceAccount string) (*storage.Client, error)
- func NewRedisClient(rconfig *config.RedisConfig) (*redis.Client, string, string, error)
- func StructToMap(data interface{}) (map[string]interface{}, error)
- func Writable(path string) bool
- type BsploggerOutput
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AckTrimStreamSegment ¶
func AckTrimStreamSegment(redisClient *redis.Client, segmentLength int, streamKey, consumerGroup string, streamIDs []string) (int64, error)
AckTrimStreamSegment acknowledges a stream segment from the redis stream
func DecodeAvro ¶
DecodeAvro tries to decode a data buffer, read it and store it on the input record. If successfully, the record is filled with data from the buffer, otherwise an error might be returned
func EncodeAvro ¶
EncodeAvro returns a byte slice representing the binary encoding of the input avro record
func ExpandPath ¶
ExpandPath expands a file path 1. replace tilde with users home dir 2. expands embedded environment variables 3. cleans the path, e.g. /a/b/../c -> /a/c Note, it has limitations, e.g. ~someuser/tmp will not be expanded
func GetLogLocationURL ¶
GetLogLocationURL gets full path of log directory for current user or creates it
func NewEthClient ¶
NewEthClient initializes a new ethereum client using an address string
func NewGCPStorageClient ¶
NewGCPStorageClient initializes a new gcp storage client using a service account string
func NewRedisClient ¶
func NewRedisClient(rconfig *config.RedisConfig) (*redis.Client, string, string, error)
NewRedisClient provides a new redis client using a redis config
func StructToMap ¶
StructToMap converts a struct to go map
Types ¶
type BsploggerOutput ¶
type BsploggerOutput struct {
// contains filtered or unexported fields
}
BsploggerOutput logger that can log to file (lumberjack) as well as stdout
func NewLoggerOut ¶
func NewLoggerOut(writers ...io.Writer) BsploggerOutput
NewLoggerOut combine all writers to create a new writer