conf

package
v0.2.0-alpha Latest Latest
Warning

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

Go to latest
Published: Apr 2, 2024 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func GetAddress

func GetAddress(host string, port string) string

GetAddress concatenates host and port strings and returns an address in the format of "host:port".

func ParseFlags

func ParseFlags() (string, string, string)

ParseFlags parses command line flags and returns the values.

Types

type AggregateSchedulesConfig

type AggregateSchedulesConfig struct {
	BufferSize  int // Channel buffer size
	Routines    int // Number of workers aggregating schedules
	BatchSize   int // Batchsize of schedules for bulk update
	FlushPeriod int // Flush period in seconds after which schedule batches are pushed to db (even if they are not full)
}

AggregateSchedulesConfig represents the configuration options for schedule aggregation.

type AppLevelConfiguration

type AppLevelConfiguration struct {
	// Requests are rejected if the schedule time is beyond specified FutureScheduleCreationPeriod (in days) from current time
	FutureScheduleCreationPeriod int

	// Period in days for which schedules are kept in DB after the schedules are fired
	FiredScheduleRetentionPeriod int

	// Maximum Payload size in bytes allowed
	PayloadSize int

	// Http Retries for requests
	HttpRetries int

	// HTTP Timeout in milliseconds for requests
	HttpTimeout int
}

type BulkActionConfig

type BulkActionConfig struct {
	BufferSize int // Channel buffer size
	Routines   int // Number of workers aggregating schedules
}

TODO: Need to take care of maintaining history for delete action BulkActionConfig represents the configuration options for bulk actions.

type CassandraConfig

type CassandraConfig struct {
	Hosts          string            // Comma-separated list of Cassandra hosts
	Consistency    gocql.Consistency // Consistency level for Cassandra operations
	DataCenter     string            // Name of the data center to connect to
	ConnectionPool ConnectionPool    // Connection pool configuration
}

CassandraConfig represents the configuration for connecting to a Cassandra cluster, including hosts, consistency level, data center, and connection pool settings.

type ClusterConfig

type ClusterConfig struct {
	ClusterName      string   // Name of the cluster
	Address          string   // Address of the cluster
	TChannelPort     string   // TChannel port for inter-node communication
	BootStrapServers []string // List of bootstrap servers for cluster formation
	JoinSize         int      // Number of nodes required to form a cluster
	Log              Log      // Logging configuration

	//TODO: move it to DB config
	PageSize      int // Page size for pagination
	NumRetry      int // Number of retries for failed operations
	ReplicaPoints int // Number of replica points for data replication
}

ClusterConfig represents the configuration of a ringpop cluster, including its name, address, TChannel port, bootstrap servers, and other settings.

type ClusterDBConfig

type ClusterDBConfig struct {
	ClusterKeySpace   string          // Keyspace for the cluster
	DBConfig          CassandraConfig // Cassandra configuration for the cluster
	EntityHistorySize int             // Size of the entity history
}

ClusterDBConfig represents the configuration for a cluster database, including keyspace, database configuration, and entity history size.

type Configuration

type Configuration struct {
	HttpPort                 string                   // Port for the HTTP server
	ConfigFile               string                   `json:"-"` // Configuration file path
	SchemaPath               string                   // Configuration options for Cassandra Schema path
	Cluster                  ClusterConfig            // Configuration options for the cluster
	ClusterDB                ClusterDBConfig          // Configuration options for the cluster database
	ScheduleDB               ScheduleDBConfig         // Configuration options for the schedule database
	Poller                   PollerConfig             // Configuration options for the poller
	MonitoringConfig         MonitoringConfig         // Configuration options for monitoring
	HttpConnector            HttpConnectorConfig      // Configuration options for the HTTP connector
	CronConfig               CronConfig               // Configuration options for the cron scheduler
	StatusUpdateConfig       StatusUpdateConfig       // Configuration options for status updates
	AggregateSchedulesConfig AggregateSchedulesConfig // Configuration options for schedule aggregation
	NodeCrashReconcile       NodeCrashReconcile       // Configuration options for node crash reconciliation
	BulkActionConfig         BulkActionConfig         // Configuration options for bulk actions
	AppLevelConfiguration    AppLevelConfiguration    // Configuration options for app level configuration
	DCConfig                 DCConfig                 // Configuration options for DC configuration
}

Configuration represents the main configuration structure, including fields for various components and settings.

func InitConfig

func InitConfig(confFile, port, address string) *Configuration

InitConfig initializes the configuration by setting default values, parsing command line flags, and loading the configuration from the specified file. It returns a pointer to a Configuration struct.

func LoadConfig

func LoadConfig(confFile string) *Configuration

LoadConfig loads the configuration from a JSON file and populates a Configuration struct. It returns a pointer to the populated struct. If there's an error while loading the configuration file, the function will log a fatal error and exit the application.

func NewConfig

func NewConfig(opts ...Option) *Configuration

type ConnectionPool

type ConnectionPool struct {
	InitialConnectTimeout int // Initial connection timeout in milliseconds
	ConnectTimeout        int // Connection timeout in milliseconds
	MaxNumConnections     int // Maximum number of connections in the pool
}

ConnectionPool represents the configuration for a connection pool, including initial connect timeout, connect timeout, and maximum number of connections.

type CronConfig

type CronConfig struct {
	App string // Name of the special app which converts the recurring schedules to one time schedules.
	// A special schedule retriever will be used by this app pollers.
	Window   time.Duration // The time window within which new future one time schedules for the recurring schedules will be created.
	Routines int           // Number of worker routines converting the schedules to one time.
}

Configurations for cron conversions

type DCConfig

type DCConfig struct {
	// used to prefix appIds
	Prefix string

	// location of the DC
	Location string
}

type EventListener

type EventListener struct {
	AppName             string // Name of the application associated with the listener
	EventName           string // Name of the event the listener is listening for
	ConcurrentListeners int    // Number of concurrent listeners
	ConsumerCount       int    // Number of consumers for each listener
}

EventListener represents the configuration for an event listener, including the application name, event name, number of concurrent listeners, and consumer count.

type HttpConnectorConfig

type HttpConnectorConfig struct {
	Routines      int           // Number of concurrent routines for processing
	MaxRetry      int           // Maximum number of retries for failed requests
	TimeoutMillis time.Duration // Timeout for HTTP requests in milliseconds
}

HttpConnectorConfig represents the configuration for an HTTP connector, including the number of routines, maximum retries, and timeout settings.

type Log

type Log struct {
	Enable bool // Indicates if logging is enabled
}

Log represents the logging configuration, including whether logging is enabled.

type MonitoringConfig

type MonitoringConfig struct {
	Statsd *StatsdConfig // Configuration options for Statsd
}

MonitoringConfig represents the configuration options for monitoring, including Statsd configuration.

type NewrelicConfig

type NewrelicConfig struct {
	LicenseKey string // License key for the New Relic agent
	AppName    string // Name of the application being monitored
	Enable     bool   // Indicates if the New Relic agent is enabled
}

NewrelicConfig represents the configuration for a New Relic monitoring agent, including the license key, application name, and whether it is enabled.

type NodeCrashReconcile

type NodeCrashReconcile struct {
	NeedsReconcile  bool
	ReconcileOffset int
}

NodeCrashReconcile represents the configuration options for reconciling node crashes.

type Option

type Option func(*Configuration)

func WithAggregateSchedulesConfig

func WithAggregateSchedulesConfig(aggregateSchedulesConfig AggregateSchedulesConfig) Option

func WithAppLevelConfiguration

func WithAppLevelConfiguration(appLevelConfiguration AppLevelConfiguration) Option

func WithBulkActionConfig

func WithBulkActionConfig(bulkActionConfig BulkActionConfig) Option

func WithClusterConfig

func WithClusterConfig(clusterConfig ClusterConfig) Option

func WithClusterDB

func WithClusterDB(clusterDB ClusterDBConfig) Option

func WithConfigFile

func WithConfigFile(configFile string) Option

func WithCronConfig

func WithCronConfig(cronConfig CronConfig) Option

func WithDCConfiguration

func WithDCConfiguration(dcConfig DCConfig) Option

func WithHTTPPort

func WithHTTPPort(port string) Option

func WithHttpConnectorConfig

func WithHttpConnectorConfig(httpConnectorConfig HttpConnectorConfig) Option

func WithMonitoringConfig

func WithMonitoringConfig(monitoringConfig MonitoringConfig) Option

func WithNodeCrashReconcileConfig

func WithNodeCrashReconcileConfig(reconcile NodeCrashReconcile) Option

func WithPoller

func WithPoller(poller PollerConfig) Option

func WithScheduleDB

func WithScheduleDB(scheduleDB ScheduleDBConfig) Option

func WithSchemaPath

func WithSchemaPath(schemaPath string) Option

func WithStatusUpdateConfig

func WithStatusUpdateConfig(statusUpdateConfig StatusUpdateConfig) Option

func WithUpdateStatusConfig

func WithUpdateStatusConfig(statusUpdateConfig StatusUpdateConfig) Option

type PollerConfig

type PollerConfig struct {
	Interval     int    // Polling interval in seconds
	DefaultCount uint32 // Default number of items to be polled
}

PollerConfig represents the configuration for a poller, including interval, buffer size, and default count.

type RingPopConfig

type RingPopConfig struct {
	Host string // Hostname or IP address of the RingPop instance
	Port int    // Port number on which the RingPop instance is listening
}

RingPopConfig represents the configuration for a RingPop instance, including the host and port information.

type ScheduleDBConfig

type ScheduleDBConfig struct {
	ScheduleKeySpace  string          // Keyspace for the schedule
	ScheduleTableName string          // Table name for the schedule
	DBConfig          CassandraConfig // Cassandra configuration for the schedule
}

ScheduleDBConfig represents the configuration for a schedule database, including keyspace, table name, database configuration, and TTL settings.

type StatsdConfig

type StatsdConfig struct {
	Enabled bool   // Indicates if the StatsD client is enabled
	Address string // Address of the StatsD server, in the format "host:port"
	Prefix  string // Optional prefix for metric names
}

StatsdConfig represents the configuration for a StatsD client, including whether it is enabled, its address, and an optional prefix for metrics.

type StatusUpdateConfig

type StatusUpdateConfig struct {
	Routines int // Number of workers updating status of schedules
}

StatusUpdateConfig represents the configuration options for status updates of schedules.

Jump to

Keyboard shortcuts

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