Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Configure notifications disabled on standalone CLI #531

Merged
merged 1 commit into from
Sep 25, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions cmd/standalone/cmd.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,8 @@ func init() {
Cmd.Flags().StringVar(&conf.WalDir, "wal-dir", "./data/wal", "Directory for write-ahead-logs")
Cmd.Flags().DurationVar(&conf.WalRetentionTime, "wal-retention-time", 1*time.Hour, "Retention time for the entries in the write-ahead-log")
Cmd.Flags().BoolVar(&conf.WalSyncData, "wal-sync-data", true, "Whether to sync data in write-ahead-log")

Cmd.Flags().BoolVar(&conf.NotificationsEnabled, "notifications-enabled", true, "Whether notifications are enabled")
Cmd.Flags().DurationVar(&conf.NotificationsRetentionTime, "notifications-retention-time", 1*time.Hour, "Retention time for the db notifications to clients")
Cmd.Flags().Int64Var(&conf.DbBlockCacheMB, "db-cache-size-mb", kv.DefaultFactoryOptions.CacheSizeMB,
"Max size of the shared DB cache")
Expand Down
12 changes: 9 additions & 3 deletions server/standalone.go
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,12 @@ import (
type StandaloneConfig struct {
Config

NumShards uint32
NumShards uint32
NotificationsEnabled bool
}

type Standalone struct {
config StandaloneConfig
rpc *publicRpcServer
kvFactory kv.Factory
walFactory wal.Factory
Expand All @@ -56,7 +58,8 @@ func NewTestConfig(dir string) StandaloneConfig {
PublicServiceAddr: "localhost:0",
MetricsServiceAddr: "",
},
NumShards: 1,
NumShards: 1,
NotificationsEnabled: true,
}
}

Expand All @@ -66,7 +69,7 @@ func NewStandalone(config StandaloneConfig) (*Standalone, error) {
slog.Any("config", config),
)

s := &Standalone{}
s := &Standalone{config: config}

kvOptions := kv.FactoryOptions{DataDir: config.DataDir}
s.walFactory = wal.NewWalFactory(&wal.FactoryOptions{
Expand Down Expand Up @@ -119,6 +122,9 @@ func (s *Standalone) initializeShards(numShards uint32) error {
if _, err := lc.NewTerm(&proto.NewTermRequest{
Shard: i,
Term: newTerm,
Options: &proto.NewTermOptions{
EnableNotifications: s.config.NotificationsEnabled,
},
}); err != nil {
return err
}
Expand Down
Loading