1110 Commits (8118340a3db3c9151678ef8be0ebbb7a735f0900)
 

Author SHA1 Message Date
Sayan Nandan f6f4221047
Fix random port allocation for Windows
Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 3f5848d49a
Fix test macro that caused test runs to fail
With upstream changes to Tokio, the API for `Shutdown<'_, T>` as defined
by the `AsyncWriteExt` trait has changed. This change requires us to
await the function and then handle the result.
The macro definition was changed as a consequence.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
dependabot[bot] 4915121ce8 Bump syn from 1.0.56 to 1.0.57
Bumps [syn](https://github.com/dtolnay/syn) from 1.0.56 to 1.0.57.
- [Release notes](https://github.com/dtolnay/syn/releases)
- [Commits](https://github.com/dtolnay/syn/compare/1.0.56...1.0.57)

Signed-off-by: dependabot[bot] <support@github.com>
4 years ago
Sayan Nandan 052898ee9e
Fix binary build step
Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 357f57250b
Add binary build step for docker image
The binary needs to be built before it can be copied into the container.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan 5391f2a694
Re-enable docker image builds
This commit re-enables docker image builds which was moved to a different CI server in a previous commit.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
dependabot[bot] 7a7b0fee49 Bump devtimer from 4.0.0 to 4.0.1
Bumps [devtimer](https://github.com/ohsayan/devtimer) from 4.0.0 to 4.0.1.
- [Release notes](https://github.com/ohsayan/devtimer/releases)
- [Changelog](https://github.com/ohsayan/devtimer/blob/master/CHANGELOG.md)
- [Commits](https://github.com/ohsayan/devtimer/commits)

Signed-off-by: dependabot[bot] <support@github.com>
4 years ago
dependabot[bot] 3c24c1c74b Bump serde_json from 1.0.60 to 1.0.61
Bumps [serde_json](https://github.com/serde-rs/json) from 1.0.60 to 1.0.61.
- [Release notes](https://github.com/serde-rs/json/releases)
- [Commits](https://github.com/serde-rs/json/compare/v1.0.60...v1.0.61)

Signed-off-by: dependabot[bot] <support@github.com>
4 years ago
Sayan Nandan 43ac93b47d
Fix kvengine tests
Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan f2031129ce
Upgrade dependencies
Closes #59, closes #60, closes #61, closes #62, closes #63 and closes #64.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 25d211d0a2
Implement `Con<'_>` object for TLS/non-TLS streams
This object either holds a mutable reference to an unencrypted TCP
stream or an encrypted TLS stream (using OpenSSL). The action handlers
were modified as a consequence.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 43bb178954
Implement basic TLS module and connection handler
This commit implements 'TLS versions' of `CHandler` and `Listener` from
`dbnet`.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan 9404c5444d Add more information on the license 4 years ago
Sayan Nandan 0087d6b07c
Add basic SSL/TLS listener
This commit adds a basic SSL/TLS listener using `openssl`.
The `SslListener` object can accept a connection and get a decrypted
stream.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
dependabot[bot] 5d17e0a89d
Upgrade deps
Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan a9bd9be988
Use `IntoBinaryData` for multi namespace ser-de
This makes sure that we can implement serialization for multiple types.

At the same time, we DON'T put in blanket implementations for this trait
as we want to make sure that unintended things don't get flushed.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan c83dbd0436
Improve error handling in snapstore
We've made the error handling slightly 'less aggressive' than the
previous version which `unwrap`ped here and there.

Also, the documentation for the entire snapstore module was greatly
improved.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 632a198ede
Implement multi-ns ser and de
This commit provides an implementation which allows multiple 'named'
namespaces to be serialized and deserialized.

No information about the data needs to be known for deserialization;
To facilitate this, a partition map is implemented which is stored as a
separate file. For now, the data file is called `snapstore.bin` and the
partition metadata file is called partmap.

The partition map (`PartMap`) contains a vector of `Partition` objects.
This object stores 'markers' (`len`) which are ideally byte positions
or offsets that demarcate the locations of the individual namespaces.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan c1f126ecb4
Drop netpool object before writing to stdout
Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan f6b25ce48c
Don't clone when writing data to disk
Previously we were cloning data before writing to disk which
caused slowdowns and lead to higher memory usage. This is an
attempt to fix this behavior.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 771bf46e27
Enable mock-keys to be created with the bench tool
This can help us create 'fake' key/value pairs for testing purposes and
memory usage analysis.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan 21905b582d
Use parallel jobs for faster builds 4 years ago
Sayan Nandan 94c400c962
Enable actions to be run without the REPL in tsh
If any user needs to run an action without the REPL, they can now do it
by running `tsh -e 'expr'`

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 7af818f751
Allow custom host and port to be set in tdb-bench
Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan 5d7826976c
Use arch for build cache filename
Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan 9c7f4f04af
Utilize caching for builds (#44)
Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan b257b7286d
Further reduce the size of the docker image
Also the deps were upgraded (there's no point of dependabot creating
multiple commits for upgrading deps)

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan 597a82ddf0
Use binary for building docker image (#40)
* Use binary for building docker image

In the previous workflow, we were building and testing twice: once for
the docker image and once for the test step. Now, we'll build a debug
version in the test step, then build a release version and finally copy
that into the docker image. This would heavily reduce our build times.

* Ignore specific files in target to speed up builds

* Build image only when pushed to next or tagged

* Fix build condition

Since both conditions have to evaluate to true, we'll need to use refs
while also matching against both `push` and `tag` events

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 792351108d
Rollout 0.5.0
Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan c7b4a8396b
Stop using ubuntu image to reduce build times
We were previously using the ubuntu image and then manually installing
rust. From now on, we'll use the rust docker image instead to avoid huge
build times

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 03965d6b5b
Add drone CI
Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan bfb4b920df
Bump up version and add changelog entry
Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 5ecc6f55f4
Drop the read lock to avoid perpetual waits
We previously made a big mistake: we tried to set poisoned to true, an
operation that requires a write lock, without dropping the read lock.
This commit ensures that we first drop `rlock` before doing anything
else. At the same time, if BGSAVE has failed, we'll just shut down the
service.

The error descriptions were improved for a failed `get_saved`
operation. And finally, a couple of variables in `MKSNAP` were renamed
to make them sound more sensible.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 106c5bc219
Use refs instead of cloning for pre-compiled resps
For this, `Writable` was implemented for `&'static [u8]`.
Although this won't have a very noticeable impact on performance, we
will stick to using references instead of cloning the data and then
referencing it again.

Along with this, the docs for MKSNAP were updated.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 9e61921170
Revise random port allocation logic
Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan f68b8f26a2
Skip builds on pushes to tags
There's no point of running tests on tags since we only create tags
after the build for the corresponding commit has succeeded.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 76e6232242
Stop accepting writes if BGSAVE fails
Let's say that BGSAVE fails for some reason or the other. As it is
our responsibility to ensure the integrity of the user's data and
to enforce the reliability of the overall database, we should
immediately stop accepting writes, so that new changes aren't made
since the last time flushing data to the disk succeeded.

The functions under kvengine were modified as a consequence, and they
will return an "Internal Server Error" which is response code 5 if
the database is poisoned.

To put it in one line: If running BGSAVE fails, we'll `poison` the
in-memory table and stop accepting write operations, which ideally is
any operation that attempts to obtain a write lock.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan f9932a5b97
Provide default params for queries, cons and size
Instead of forcing the user to provide values for the number of
connections, queries and the packet size, we'll default to presets
if they aren't supplied.

Also, we've switched the output from stdout to stderr to facilitate
commands like `tdb-bench --json > report.json`

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan cbebda85b0
Enable JSON output for `tdb-bench`
This commit enables JSON output for the benchmark tool.
This is an effort to support automated benchmarking, once we do have
such a facility in the future. This closes #37

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 824944e30e
Don't use an explicit `enabled` flag in `snapshot`
There is no merit in having a redundant `enabled` key under
`snapshot` in the configuration file; if a `snapshot` key is present,
it is inherently obvious that snapshotting is enabled

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan d23c4ee947
Fix issues with the Dockerfile
Using the configuration file has been a bad idea and this is why we're
switching to using command line args.

Also links and docs were updated

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan b09beefe60
Don't check remote dir every time MKSNAP is called
Instead of checking to see if the remote snapshots directory exists
whenever MKSNAP is called, we'll create the directory when the server
starts up

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan a0fea2ee08
Enable remote snapshots even if disabled
Since creating snapshots is quite an important utility,
there may be scenarios where creating one may be needed,
even if it is disabled on the server side. This commit
enables such snapshots to be created. This is achieved by
enabling MKSNAP to accept two arguments, where a 'named'
snapshot can be created, which is our "special" snapshot.

All these "special" snapshots are stored in a separate
"snapshots/remote" dir that is ignored by the
`SnapshotEngine`.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 7232fe9189
Enable tdb-bench to read args and opts from shell
From now on, tdb-bench has to be run with
`tdb-bench -c <c> -q <q> -s <s>` instead of just using positional args.
Also, we'll keep `tdb-bench`'s version in
sync with the version of `tdb`, just like the others in the project

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 477acfab4b
Allow tsh to process flags and opts from the shell
This commit enables processing for flags and
options for `tsh`. This is a breaking change as it prevents
users from using the previous launch arguments and
instead requires them to use a `-h` and `-p` combination

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 951880817b
Let snapshots and bgsave opts be set via cmd args
Following on from ab9561258e, we'll allow
the user to configure snapshots and BGSAVE via command-line arguments

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan ab9561258e
Enable command line configuration
Until now, the database server could only be configured via the
configuration file. This commit enables the host, port and noart
options to be configured via command-line arguments.

This is important as there may be scenarios where creating a file
presents a challenge to the user.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan 5c1fbae609
Fix test for the snapshot config file
Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan cf3d213b3f
Enable data to be restored from a snapshot
The user can now run `tdb -r <snapshotname>` to restore data from the
snapshot. Also, we'll show a note in the logs when trying to restore from
a snapshot

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago
Sayan Nandan f06f81cd5c
Remove the `CyanSFW` module
This module isn't doing anything good staying here, as it does nothing!
More work needs to be done on the file storage format internally before
a public rollout.

Signed-off-by: Sayan Nandan <nandansayan@outlook.com>
4 years ago