users

package
v0.0.0-...-8aeb8a1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2023 License: MIT Imports: 25 Imported by: 0

Documentation

Index

Constants

View Source
const (
	AnonymousQueueName  = "users_recognition"
	IdentifiedQueueName = "users_identified"
	AggregatedQueueName = "users_aggregated"
)
View Source
const (
	DummyStorageType = "dummy"
	RedisStorageType = "redis"
)
View Source
const (
	GZIPCompressorType = "gzip"
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Compressor

type Compressor interface {
	Compress(payload interface{}) []byte
	Decompress(compressed []byte) (map[string]interface{}, error)
}

type Dummy

type Dummy struct{}

func (*Dummy) Close

func (d *Dummy) Close() error

func (*Dummy) DeleteAnonymousEvent

func (d *Dummy) DeleteAnonymousEvent(tokenID, anonymousID string, eventID ...string) error

func (*Dummy) GetAnonymousEvents

func (d *Dummy) GetAnonymousEvents(tokenID, anonymousID string) (map[string]string, error)

func (*Dummy) SaveAnonymousEvent

func (d *Dummy) SaveAnonymousEvent(tokenID, anonymousID, eventID, payload string) error

func (*Dummy) Type

func (d *Dummy) Type() string

type DummyCompressor

type DummyCompressor struct{}

func (*DummyCompressor) Compress

func (dc *DummyCompressor) Compress(payload interface{}) []byte

func (*DummyCompressor) Decompress

func (dc *DummyCompressor) Decompress(compressed []byte) (map[string]interface{}, error)

type EventKey

type EventKey struct {
	TokenID     string
	AnonymousID string
}

type GZIPCompressor

type GZIPCompressor struct{}

func (*GZIPCompressor) Compress

func (c *GZIPCompressor) Compress(payload interface{}) []byte

func (*GZIPCompressor) Decompress

func (c *GZIPCompressor) Decompress(compressed []byte) (map[string]interface{}, error)

type Queue

type Queue struct {
	// contains filtered or unexported fields
}

func (*Queue) Close

func (q *Queue) Close() error

Close closes underlying queue

func (*Queue) DequeueBlock

func (q *Queue) DequeueBlock() (interface{}, error)

func (*Queue) Enqueue

func (q *Queue) Enqueue(rp interface{}) error

func (*Queue) Size

func (q *Queue) Size() int64

type RecognitionPayload

type RecognitionPayload struct {
	EventID              string
	EventKey             EventKey
	AnonymousEventBytes  string
	IdentificationValues map[string]interface{}
}

RecognitionPayload is a queue dto

type RecognitionService

type RecognitionService struct {
	// contains filtered or unexported fields
}

RecognitionService has a thread pool under the hood saves anonymous events in meta storage rewrites recognized events

func NewRecognitionService

func NewRecognitionService(storage Storage, destinationService *destinations.Service, configuration *config.UsersRecognition, userAgentPath string) (*RecognitionService, error)

NewRecognitionService creates a new RecognitionService if metaStorage configuration exists

func (*RecognitionService) Close

func (rs *RecognitionService) Close() (multiErr error)

Close sets closed flag = true (stop goroutines) closes the queue

func (*RecognitionService) Event

func (rs *RecognitionService) Event(event events.Event, eventID string, destinationIDs []string, tokenID string)

Event consumes events.Event and put it to the recognition queue

type Redis

type Redis struct {
	// contains filtered or unexported fields
}

func NewRedis

func NewRedis(pool *meta.RedisPool, anonymousEventsMinutesTTL int) *Redis

func (*Redis) Close

func (r *Redis) Close() error

func (*Redis) DeleteAnonymousEvent

func (r *Redis) DeleteAnonymousEvent(tokenID, anonymousID string, eventID ...string) error

DeleteAnonymousEvent deletes event with eventID

func (*Redis) GetAnonymousEvents

func (r *Redis) GetAnonymousEvents(tokenID, anonymousID string) (map[string]string, error)

GetAnonymousEvents returns events JSON per event ID map

func (*Redis) SaveAnonymousEvent

func (r *Redis) SaveAnonymousEvent(tokenID, anonymousID, eventID, payload string) error

SaveAnonymousEvent saves event JSON by tokenID and user anonymous ID key

func (*Redis) Type

func (r *Redis) Type() string

type Storage

type Storage interface {
	io.Closer
	SaveAnonymousEvent(tokenID, anonymousID, eventID, payload string) error
	GetAnonymousEvents(tokenID, anonymousID string) (map[string]string, error)
	DeleteAnonymousEvent(tokenID, anonymousID string, eventID ...string) error
	Type() string
}

func InitializeStorage

func InitializeStorage(enabled bool, metaStorageConfiguration *viper.Viper) (Storage, error)

InitializeStorage returns configured users.Storage (redis or dummy)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL