From 1bd7147e99a82ec14d679e21e0fad289d6700b71 Mon Sep 17 00:00:00 2001 From: Kelvin Mwinuka Date: Thu, 4 Apr 2024 21:36:43 +0800 Subject: [PATCH] Added Configuration and Eviction Sections in README.md --- README.md | 170 ++++++++++++++++++++++++++++++++++++-- coverage/coverage.out | 154 +++++++++++++++++----------------- internal/config/config.go | 27 +++--- 3 files changed, 255 insertions(+), 96 deletions(-) diff --git a/README.md b/README.md index a776f5d0..255ecbf0 100644 --- a/README.md +++ b/README.md @@ -52,7 +52,10 @@ much more powerful. Features in the roadmap include: 6) JSON 7) Improved Observability -# Usage +# Usage (Embedded) + +Install EchoVault with: `go get github.com/echoVault/echoVault`. +Run `go mod tidy` to pull all of EchoVault's dependencies. Here's an example of using EchoVault as an embedded library. You can access all of EchoVault's commands using an ergonomic API. @@ -108,8 +111,7 @@ func main() { An embedded EchoVault instance can still be part of a cluster, and the changes triggered from the API will be consistent across the cluster. - -# Installing +# Usage (Client-Server) ### Homebrew @@ -127,9 +129,8 @@ Next, [install the client via homebrew](https://github.com/EchoVault/EchoVault-C You can download the binaries by clicking on a release tag and downloading the binary for your system. -### Configuration -Checkout the [configuration wiki page](https://github.com/EchoVault/EchoVault/wiki/Configuration) for the possible configuration -flags +Checkout the [configuration section](#configuration) for the possible configuration +flags. # Clients @@ -149,6 +150,163 @@ Steps: 2) If you're on MacOS, you can run `make build && docker-compose up --build` to build the project and spin up the development docker container. 3) If you're on another OS, you will have to use `go build` with the relevant flags for your system. +# Table of Contents +1. [Configuration](#configuration) +2. [Eviction](#eviction) +3. [Contribution](#contribution) + +# Configuration + +EchoVault is highly configurable. It provides the following configuration options to you: + +Flag: `--config`
+Type: `string/path`
+Description: The file path for the server configuration. A JSON or YAML file can be used for server configuration. You can combine CLI flags and config files, but remember that config files override CLI flags. The config file will be prioritised if you have the same config option in the CLI flags and the config file. + +Flag: `--port`
+Type: `integer`
+Description: The port on which to listen to client connections. The default is `7480`. + +Flag: `--bind-addr`
+Type: `string`
+Description: Specify the IP address to which the listener is bound. + +Flag: `--require-pass`
+Type: `boolean`
+Description: Determines whether the server should require a password for the default user before allowing commands. The default is `false`. If this option is provided, it must be accompanied by the `--password` config. + +Flag: `--password`
+Type: `string`
+Description: The password used to authorize the default user to run commands. This flag should be provided alongside the `--require-pass` flag. + +Flag: `--tls`
+Type: `boolean`
+Description: A TLS connection with a client is required. The default is `false`. + +Flag: `mtls`
+Type: `boolean`
+Description: Require mTLS connection with client. It is useful when the client and the server need to verify each other. If `--tls` and `mtls` are provided, `--mtls` will take higher priority. The default is `false`. + +Flag: `--cert-key-pair`
+Type: `string`
+Description: The cert/key pair used by the server to authenticate itself to the client when using TLS or mTLS. This flag can be provided multiple times with multiple cert/key pairs. This is a comma-separated string in the following format: `,`, + +Flag: `--client-ca`
+Type: `string`
+Description: The path to the RootCA that is used to verify client certs when the `--mtls` flag is provided to enable verifying the client. This flag can be passed multiple times with paths to several client RootCAs. + +Flag: `--server-id`
+Type: `string`
+Description: If this node is part of a raft replication cluster, then this flag provides the server ID to use within the cluster configuration. This ID must be unique to all the other nodes' IDs in the cluster. + +Flag: `--join-addr`
+Type: `string`
+Description: When adding a node to a replication cluster, this is the address and port of any cluster member. The current node will use this to request permission to join the cluster. The format of this flag is `:`. + +Flag: `--raft-port`
+Type: `integer`
+Description: If starting a node in a raft replication cluster, this port will be used for communication between nodes on the raft layer. The default is `7481`. + +Flag: `--memberlist-port`
+Type: `integer`
+Description. If starting a node in a replication cluster, this port is used for communication between nodes on the memberlist layer. The default is `7946`. + +Flag: `--in-memory`
+Type: `boolean`
+Description: When starting a node in a raft replication cluster, this directs the raft layer to store logs and snapshots in memory. It is only recommended in test mode. The default is `false`. + +Flag: `--data-dir`
+Type: `string`
+Description: The directory for storing Append-Only Logs, Write Ahead Logs, and Snapshots. The default is `/var/lib/echovault` + +Flag: `--bootstrap-cluster`
+Type: `boolean`
+Description: Whether to initialize a new replication cluster with this node as the leader. The default is `false`. + +Flag: `--acl-config`
+Type: `string`
+Description: The file path for the ACL layer config file. The ACL configuration file can be a YAML or JSON file. + +Flag: `--snapshot-threshold`
+Type: `integer`
+Description: The number of write commands required to trigger a snapshot. The default is `1,000` + +Flag: `--snapshot-interval`
+Type: `string`
+Description: The interval between snapshots. You can provide a parseable time format such as `30m45s` or `1h45m`. The default is 5 minutes. + +Flag: `--restore-snapshot`
+Type: `boolean`
+Description: Determines whether to restore from a snapshot on startup. The default is `false`. + +Flag: `--restore-aof`
+Type: `boolean`
+Description: This flag determines whether to restore from an aof file on startup. If both this flag and `--restore-snapshot` are provided, this flag will take higher priority. + +Flag: `--forward-commands`
+Type: `boolean`
+Description: This flag allows you to send write commands to any node in the cluster. The node will forward the command to the cluster leader. When this is false, write commands can only be accepted by the leader. The default is `false`. + +Flag: `--max-memory`
+Type: `string`
+Examples: "200mb", "8gb", "1tb"
+Description: The maximum memory usage that EchoVault should observe. Once this limit is reached, the chosen key eviction strategy is triggered. The default is no limit. + +Flag: `--eviction-policy`
+Type: `string`
+Description: This flag allows you to choose the key eviction strategy when the maximum memory is reached. The flag accepts the following options:
+1) noeviction - Do not evict any keys even when max-memory is exceeded. All new write operations will be rejected. This is the default eviction strategy. +2) allkeys-lfu - Evict the least frequently used keys when max-memory is exceeded. +3) allkeys-lru - Evict the least recently used keys when max-memory is exceeded. +4) volatile-lfu - Evict the least frequently used keys with an expiration when max-memory is exceeded. +5) volatile-lru - Evict the least recently used keys with an expiration when max-memory is exceeded. +6) allkeys-random - Evict random keys until we get under the max-memory limit when max-memory is exceeded. +7) volatile-random - Evict random keys with an expiration when max-memory is exceeded. + +Flag: `--eviction-sample`
+Type: `integer`
+Description: An integer specifying the number of keys to sample when checking for expired keys. By default, EchoVault will sample 20 keys. The sampling is repeated if the number of expired keys found exceeds 20%. + +Flag: `--eviction-interval`
+Type: `string`
+Example: "10s", "5m30s", "100ms"
+Description: The interval between each sampling of keys to evict. By default, this happens every 100 milliseconds. + +# Eviction + +### Memory Limit +The memory limit can be set using the --max-memory config flag. This flag accepts a parsable memory value (e.g 100mb, 16gb). If the limit set is 0, then no memory limit is imposed. The default value is 0. + +### Passive eviction +In passive eviction, the expired key is not deleted immediately once the expiry time is reached. The key will remain in the store until the next time it is accessed. When attempting to access an expired key, that is when the keys is deleted. + +### Active eviction +Echovault will run a background goroutine that samples a set of volatile keys at a given interval. Any keys that are found to be expired will be deleted. If 20% or more of the sampled keys are deleted, then the process will immediately begin again. Otherwise, wait for the given interval until the next round of sampling/eviction. The default number of keys sampled is 20 and the default interval for sampling is 100 milliseconds. These can be configured using the --eviction-sample and --eviction-interval flags respectively. + +### Eviction Policies +Eviction policy can be set using the --eviction-policy flag. The following options are available. + +noeviction:
+This policy does not evict any keys. When max memory is reached, all new write commands will be rejected until keys are manually deleted by the user. + +allkeys-lfu:
+With this policy, all keys are considered for eviction when the max memory is reached. When max memory is reached, the least frequently accessed keys will be evicted until the memory usage is under the memory limit. + +allkeys-lru:
+This policy will consider all keys for eviction when max memory is reached. The least recently accessed keys will be deleted one by one until we are below the memory limit. + +allkeys-random:
+Evict random keys until we're below the max memory limit. + +volatile-lfu:
+With this policy, only keys with an associated expiry time will be evicted to adhere to the memory limit. When the memory limit is exceeded, volatile keys will be evicted starting from the least frequently used until we are below the memory limit or are out of volatile keys to evict. + +volatile-lru:
+With this policy, only keys with an associated expiry time will be evicted to adhere to the memory limit. When the memory limit is exceeded, volatile keys will be evicted starting from the list recently used until we are below the memory limit or are out of volatile keys to evict. + +volatile-random:
+Evict random volatile keys until we're below the memory limit, or we're out of volatile keys to evict. + # Contribution Contributions are welcome! If you're interested in contributing, diff --git a/coverage/coverage.out b/coverage/coverage.out index af745fb6..e2ec5cdf 100644 --- a/coverage/coverage.out +++ b/coverage/coverage.out @@ -903,82 +903,6 @@ github.com/echovault/echovault/pkg/echovault/modules.go:108.3,108.18 1 0 github.com/echovault/echovault/pkg/echovault/modules.go:112.2,112.34 1 0 github.com/echovault/echovault/pkg/echovault/modules.go:112.34,115.3 2 0 github.com/echovault/echovault/pkg/echovault/modules.go:117.2,117.72 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:29.115,35.29 4 1 -github.com/echovault/echovault/pkg/modules/admin/commands.go:35.29,36.54 1 1 -github.com/echovault/echovault/pkg/modules/admin/commands.go:36.54,42.42 4 1 -github.com/echovault/echovault/pkg/modules/admin/commands.go:42.42,44.5 1 1 -github.com/echovault/echovault/pkg/modules/admin/commands.go:46.4,49.12 3 1 -github.com/echovault/echovault/pkg/modules/admin/commands.go:52.3,52.36 1 1 -github.com/echovault/echovault/pkg/modules/admin/commands.go:52.36,59.43 5 1 -github.com/echovault/echovault/pkg/modules/admin/commands.go:59.43,61.5 1 1 -github.com/echovault/echovault/pkg/modules/admin/commands.go:63.4,65.21 2 1 -github.com/echovault/echovault/pkg/modules/admin/commands.go:69.2,71.25 2 1 -github.com/echovault/echovault/pkg/modules/admin/commands.go:74.109,78.35 3 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:78.35,79.65 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:79.65,80.41 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:80.41,82.5 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:83.4,83.12 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:85.3,85.13 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:88.2,88.51 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:91.110,92.18 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:93.9,98.36 4 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:98.36,99.66 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:99.66,100.52 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:100.52,104.6 3 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:105.5,105.13 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:107.4,108.14 2 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:110.3,111.26 2 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:113.9,117.45 3 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:117.45,119.4 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:120.3,120.42 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:120.42,124.37 3 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:124.37,125.67 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:125.67,126.53 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:126.53,127.59 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:127.59,131.8 3 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:133.6,133.14 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:135.5,135.54 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:135.54,138.6 2 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:140.9,140.50 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:140.50,144.37 3 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:144.37,145.67 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:145.67,146.53 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:146.53,148.24 2 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:148.24,151.8 2 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:153.6,153.14 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:155.5,155.33 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:155.33,158.6 2 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:160.9,160.49 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:160.49,164.37 3 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:164.37,165.67 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:165.67,166.53 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:166.53,167.55 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:167.55,171.8 3 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:173.6,173.14 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:175.5,175.50 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:175.50,178.6 2 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:180.9,182.4 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:183.3,184.26 2 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:185.10,186.54 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:190.103,192.2 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:194.33,202.60 1 1 -github.com/echovault/echovault/pkg/modules/admin/commands.go:202.60,202.86 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:211.60,213.5 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:221.62,221.88 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:230.62,230.88 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:240.62,240.88 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:251.60,253.5 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:254.113,255.49 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:255.49,257.6 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:258.5,258.45 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:267.60,269.5 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:270.113,272.18 2 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:272.18,274.6 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:275.5,275.53 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:284.60,286.5 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:287.113,288.47 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:288.47,290.6 1 0 -github.com/echovault/echovault/pkg/modules/admin/commands.go:291.5,291.45 1 0 github.com/echovault/echovault/pkg/modules/acl/commands.go:34.108,35.34 1 1 github.com/echovault/echovault/pkg/modules/acl/commands.go:35.34,37.3 1 1 github.com/echovault/echovault/pkg/modules/acl/commands.go:38.2,39.9 2 1 @@ -1183,6 +1107,82 @@ github.com/echovault/echovault/pkg/modules/acl/commands.go:578.62,580.7 1 1 github.com/echovault/echovault/pkg/modules/acl/commands.go:589.62,591.7 1 1 github.com/echovault/echovault/pkg/modules/acl/commands.go:603.62,605.7 1 0 github.com/echovault/echovault/pkg/modules/acl/commands.go:614.62,616.7 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:29.115,35.29 4 1 +github.com/echovault/echovault/pkg/modules/admin/commands.go:35.29,36.54 1 1 +github.com/echovault/echovault/pkg/modules/admin/commands.go:36.54,42.42 4 1 +github.com/echovault/echovault/pkg/modules/admin/commands.go:42.42,44.5 1 1 +github.com/echovault/echovault/pkg/modules/admin/commands.go:46.4,49.12 3 1 +github.com/echovault/echovault/pkg/modules/admin/commands.go:52.3,52.36 1 1 +github.com/echovault/echovault/pkg/modules/admin/commands.go:52.36,59.43 5 1 +github.com/echovault/echovault/pkg/modules/admin/commands.go:59.43,61.5 1 1 +github.com/echovault/echovault/pkg/modules/admin/commands.go:63.4,65.21 2 1 +github.com/echovault/echovault/pkg/modules/admin/commands.go:69.2,71.25 2 1 +github.com/echovault/echovault/pkg/modules/admin/commands.go:74.109,78.35 3 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:78.35,79.65 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:79.65,80.41 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:80.41,82.5 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:83.4,83.12 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:85.3,85.13 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:88.2,88.51 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:91.110,92.18 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:93.9,98.36 4 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:98.36,99.66 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:99.66,100.52 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:100.52,104.6 3 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:105.5,105.13 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:107.4,108.14 2 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:110.3,111.26 2 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:113.9,117.45 3 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:117.45,119.4 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:120.3,120.42 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:120.42,124.37 3 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:124.37,125.67 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:125.67,126.53 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:126.53,127.59 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:127.59,131.8 3 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:133.6,133.14 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:135.5,135.54 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:135.54,138.6 2 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:140.9,140.50 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:140.50,144.37 3 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:144.37,145.67 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:145.67,146.53 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:146.53,148.24 2 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:148.24,151.8 2 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:153.6,153.14 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:155.5,155.33 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:155.33,158.6 2 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:160.9,160.49 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:160.49,164.37 3 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:164.37,165.67 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:165.67,166.53 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:166.53,167.55 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:167.55,171.8 3 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:173.6,173.14 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:175.5,175.50 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:175.50,178.6 2 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:180.9,182.4 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:183.3,184.26 2 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:185.10,186.54 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:190.103,192.2 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:194.33,202.60 1 1 +github.com/echovault/echovault/pkg/modules/admin/commands.go:202.60,202.86 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:211.60,213.5 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:221.62,221.88 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:230.62,230.88 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:240.62,240.88 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:251.60,253.5 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:254.113,255.49 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:255.49,257.6 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:258.5,258.45 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:267.60,269.5 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:270.113,272.18 2 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:272.18,274.6 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:275.5,275.53 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:284.60,286.5 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:287.113,288.47 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:288.47,290.6 1 0 +github.com/echovault/echovault/pkg/modules/admin/commands.go:291.5,291.45 1 0 github.com/echovault/echovault/pkg/modules/connection/commands.go:26.108,27.18 1 1 github.com/echovault/echovault/pkg/modules/connection/commands.go:28.10,29.54 1 1 github.com/echovault/echovault/pkg/modules/connection/commands.go:30.9,31.34 1 1 @@ -1565,7 +1565,7 @@ github.com/echovault/echovault/pkg/modules/hash/commands.go:326.38,328.17 2 1 github.com/echovault/echovault/pkg/modules/hash/commands.go:328.17,329.41 1 1 github.com/echovault/echovault/pkg/modules/hash/commands.go:329.41,331.13 2 1 github.com/echovault/echovault/pkg/modules/hash/commands.go:333.4,333.42 1 1 -github.com/echovault/echovault/pkg/modules/hash/commands.go:333.42,336.13 3 1 +github.com/echovault/echovault/pkg/modules/hash/commands.go:333.42,336.13 3 0 github.com/echovault/echovault/pkg/modules/hash/commands.go:338.4,338.38 1 1 github.com/echovault/echovault/pkg/modules/hash/commands.go:338.38,340.13 2 1 github.com/echovault/echovault/pkg/modules/hash/commands.go:345.2,345.25 1 1 diff --git a/internal/config/config.go b/internal/config/config.go index cd20a934..82d8c56e 100644 --- a/internal/config/config.go +++ b/internal/config/config.go @@ -109,7 +109,8 @@ There is no limit by default.`, func(memory string) error { }) evictionPolicy := constants.NoEviction - flag.Func("eviction-policy", `The eviction policy used to remove keys when max-memory is reached. The options are: + flag.Func("eviction-policy", + `The eviction policy used to remove keys when max-memory is reached. The options are: 1) noeviction - Do not evict any keys even when max-memory is exceeded. 2) allkeys-lfu - Evict the least frequently used keys. 3) allkeys-lru - Evict the least recently used keys. @@ -117,18 +118,18 @@ There is no limit by default.`, func(memory string) error { 5) volatile-lru - Evict the least recently used keys with an expiration. 6) allkeys-random - Evict random keys until we get under the max-memory limit. 7) volatile-random - Evict random keys with an expiration.`, func(policy string) error { - policies := []string{ - constants.NoEviction, - constants.AllKeysLFU, constants.AllKeysLRU, constants.AllKeysRandom, - constants.VolatileLFU, constants.VolatileLRU, constants.VolatileRandom, - } - policyIdx := slices.Index(policies, strings.ToLower(policy)) - if policyIdx == -1 { - return fmt.Errorf("policy %s is not a valid policy", policy) - } - evictionPolicy = strings.ToLower(policy) - return nil - }) + policies := []string{ + constants.NoEviction, + constants.AllKeysLFU, constants.AllKeysLRU, constants.AllKeysRandom, + constants.VolatileLFU, constants.VolatileLRU, constants.VolatileRandom, + } + policyIdx := slices.Index(policies, strings.ToLower(policy)) + if policyIdx == -1 { + return fmt.Errorf("policy %s is not a valid policy", policy) + } + evictionPolicy = strings.ToLower(policy) + return nil + }) tls := flag.Bool("tls", false, "Start the echovault in TLS mode. Default is false.") mtls := flag.Bool("mtls", false, "Use mTLS to verify the client.")