store

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

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

Go to latest
Published: Jan 23, 2025 License: MIT Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingLogOption       = errors.New("missing log option")
	ErrMissingDBOption        = errors.New("missing db option")
	ErrMissingReaderDBOption  = errors.New("missing reader db option")
	ErrMissingCleanerDBOption = errors.New("missing cleaner db option")
)

Functions

This section is empty.

Types

type CleanerOptions

type CleanerOptions struct {
	Enable        bool          `long:"enable" description:"Enable DB cleaner"`
	ActivePeriod  time.Duration `` /* 126-byte string literal not displayed */
	PassivePeriod time.Duration `` /* 131-byte string literal not displayed */
	RetentionDays int           `long:"retention-days" description:"Number of days in the past that messages must be before being deleted" default:"1"`
	BatchSize     int           `long:"batch-size" description:"Batch size of messages to be deleted in one iteration" default:"50000"`
	ReadTimeout   time.Duration `long:"read-timeout" description:"Timeout for reading from the database" default:"60s"`
	WriteTimeout  time.Duration `long:"write-timeout" description:"Timeout for writing to the database" default:"60s"`
}

type Config

type Config struct {
	Options
	Log       *zap.Logger
	DB        *sql.DB
	ReaderDB  *sql.DB
	CleanerDB *sql.DB
}

type Options

type Options struct {
	Enable                   bool          `long:"enable" description:"Enable store"`
	DbConnectionString       string        `long:"db-connection-string" description:"A Postgres database connection string"`
	DbReaderConnectionString string        `long:"reader-db-connection-string" description:"A Postgres database reader connection string"`
	ReadTimeout              time.Duration `long:"db-read-timeout" description:"Timeout for reading from the database" default:"10s"`
	WriteTimeout             time.Duration `long:"db-write-timeout" description:"Timeout for writing to the database" default:"10s"`
	MaxOpenConns             int           `long:"max-open-conns" description:"Maximum number of open connections" default:"80"`
	MetricsPeriod            time.Duration `long:"metrics-period" description:"Polling period for store metrics" default:"30s"`

	Cleaner CleanerOptions `group:"DB Cleaner Options" namespace:"cleaner"`
}

type Store

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

func New

func New(config *Config) (*Store, error)

func (*Store) Close

func (s *Store) Close()

func (*Store) InsertMessage

func (s *Store) InsertMessage(env *messagev1.Envelope) (bool, error)

func (*Store) Query

func (s *Store) Query(query *messagev1.QueryRequest) (res *messagev1.QueryResponse, err error)

Jump to

Keyboard shortcuts

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