[package]
name = "tikv"
version = "4.0.16"
authors = ["The TiKV Authors"]
description = "A distributed transactional key-value database powered by Rust and Raft"
license = "Apache-2.0"
keywords = ["KV", "distributed-systems", "raft"]
homepage = "https://tikv.org"
repository = "https://github.com/tikv/tikv/"
readme = "README.md"
edition = "2018"
publish = false

[features]
default = ["protobuf-codec"]
tcmalloc = ["tikv_alloc/tcmalloc"]
jemalloc = ["tikv_alloc/jemalloc", "engine/jemalloc", "engine_rocks/jemalloc"]
mimalloc = ["tikv_alloc/mimalloc"]
portable = ["engine/portable"]
sse = ["engine/sse"]
mem-profiling = ["tikv_alloc/mem-profiling"]
failpoints = [
  "fail/failpoints",
  "raftstore/failpoints",
  "engine_rocks/failpoints"
]
prost-codec = [
  "engine/prost-codec",
  "engine_rocks/prost-codec",
  "grpcio/prost-codec",
  "keys/prost-codec",
  "kvproto/prost-codec",
  "pd_client/prost-codec",
  "raft/prost-codec",
  "raftstore/prost-codec",
  "sst_importer/prost-codec",
  "tidb_query/prost-codec",
  "tipb/prost-codec",
  "txn_types/prost-codec",
  "encryption/prost-codec",
]
protobuf-codec = [
  "engine/protobuf-codec",
  "engine_rocks/protobuf-codec",
  "grpcio/protobuf-codec",
  "keys/protobuf-codec",
  "kvproto/protobuf-codec",
  "pd_client/protobuf-codec",
  "raft/protobuf-codec",
  "raftstore/protobuf-codec",
  "sst_importer/protobuf-codec",
  "tidb_query/protobuf-codec",
  "tipb/protobuf-codec",
  "txn_types/protobuf-codec",
  "encryption/protobuf-codec",
  "log_wrappers/protobuf-codec"
]
testexport = ["raftstore/testexport"]

[lib]
name = "tikv"

[dependencies]
async-stream = "0.2"
async-trait = "0.1"
backtrace = "0.3"
batch-system = { path = "components/batch-system", default-features = false }
bitflags = "1.0.1"
byteorder = "1.2"
chrono = "0.4"
codec = { path = "components/codec" }
configuration = { path = "components/configuration" }
crc32fast = "1.2"
crc64fast = "0.1"
crossbeam = "0.8"
derive_more = "0.99.3"
encryption = { path = "components/encryption" }
engine = { path = "components/engine" }
engine_panic = { path = "components/engine_panic", optional = true }
engine_rocks = { path = "components/engine_rocks" }
engine_traits = { path = "components/engine_traits" }
error_code = { path = "components/error_code" }
fail = "0.4"
failure = "0.1"
fs2 = "0.4"
futures = "0.1"
futures03 = { package = "futures", version = "0.3.1", features = ["compat","thread-pool"] }
futures-cpupool = "0.1"
futures-executor = "0.3.1"
futures-util = { version = "0.3.1", default-features = false, features = ["io", "async-await"] }
grpcio = { version = "0.5", default-features = false, features = ["openssl-vendored"] }
hex = "0.4"
hyper-tls = "0.4"
itertools = "0.8"
openssl = "0.10"
hyper = "0.13"
hyper-openssl = "0.8"
http = "0"
into_other = { path = "components/into_other" }
keys = { path = "components/keys" }
kvproto = { git = "https://github.com/pingcap/kvproto.git", branch = "release-4.0", default-features = false }
lazy_static = "1.3"
libc = "0.2"
log = { version = "0.4", features = ["max_level_trace", "release_max_level_debug"] }
log_wrappers = { path = "components/log_wrappers" }
match_template = { path = "components/match_template" }
matches = "0.1.8"
mime = "0.3.13"
more-asserts = "0.1"
murmur3 = "0.5.1"
nom = { version = "5.1.0", default-features = false, features = ["std"] }
num_cpus = "1"
pd_client = { path = "components/pd_client" }
pin-project = "0.4.8"
pnet_datalink = "0.23"
prost = "0.6"
protobuf = "2.8"
quick-error = "1.2.2"
raft = { version = "0.6.0-alpha", default-features = false }
raftstore = { path = "components/raftstore" }
rand = "0.7.3"
regex = "1.3"
rev_lines = "0.2.1"
security = { path = "components/security" }
serde = { version = "1.0", features = ["derive"] }
serde_derive = "1.0"
serde_json = "1.0"
slog = { version = "2.3", features = ["max_level_trace", "release_max_level_debug"] }
slog-global = { version = "0.1", git = "https://github.com/breeswish/slog-global.git", rev = "0e23a5baff302a9d7bccd85f8f31e43339c2f2c1" }
slog_derive = "0.2"
parking_lot = "0.10"
prometheus = { version = "0.8", features = ["nightly", "push"] }
sst_importer = { path = "components/sst_importer" }
sysinfo = { git = "https://github.com/tikv/sysinfo.git", branch = "tikv-4.0"}
tempfile = "3.0"
tidb_query = { path = "components/tidb_query" }
tidb_query_datatype = { path = "components/tidb_query_datatype" }
tikv_alloc = { path = "components/tikv_alloc" }
tikv_util = { path = "components/tikv_util" }
time = "0.1"
tipb = { git = "https://github.com/pingcap/tipb.git", default-features = false }
tokio = { version = "0.2", features = ["full"] }
tokio-tcp = "0.1"
tokio-core = "0.1"
tokio-fs = "0.1.6"
tokio-io = "0.1.12"
# tokio-sync = "0.1.7"
tokio-sync = { path = "components/tokio_sync"  }
tokio-threadpool = "0.1.13"
tokio-timer = "0.2"
tokio-openssl = "0.4"
toml = "0.4"
txn_types = { path = "components/txn_types" }
url = "2"
uuid = { version = "0.8.1", features = ["serde", "v4"] }
vlog = "0.1.4"
walkdir = "2"

[dependencies.prometheus-static-metric]
git = "https://github.com/tikv/rust-prometheus.git"
rev = "d919ccd35976b9b84b8d03c07138c1cc05a36087"

[dependencies.yatp]
git = "https://github.com/tikv/yatp.git"

[dev-dependencies]
panic_hook = { path = "components/panic_hook" }
test_sst_importer = { path = "components/test_sst_importer" }
test_util = { path = "components/test_util" }
tokio = { version = "0.2", features = ["macros", "rt-threaded", "time"] }
zipf = "6.1.0"

[patch.crates-io]
# TODO: remove this when new raft-rs is published.
raft = { git = "https://github.com/pingcap/raft-rs", branch = "0.6.x", default-features = false }
raft-proto = { git = "https://github.com/pingcap/raft-rs", branch = "0.6.x", default-features = false }
protobuf = { git = "https://github.com/pingcap/rust-protobuf", rev = "65e9df20fbcbcf2409d5ee86a2332ecd04c534f8" }
protobuf-codegen = { git = "https://github.com/pingcap/rust-protobuf", rev = "65e9df20fbcbcf2409d5ee86a2332ecd04c534f8" }

# TODO: remove this replacement after rusoto_s3 truly supports virtual-host style (https://github.com/rusoto/rusoto/pull/1823).
rusoto_core = { git = "https://github.com/tikv/rusoto", branch = "gh1482-s3-addr-styles" }
rusoto_credential = { git = "https://github.com/tikv/rusoto", branch = "gh1482-s3-addr-styles" }
rusoto_kms = { git = "https://github.com/tikv/rusoto", branch = "gh1482-s3-addr-styles", features = ["serialize_structs"] }
rusoto_mock = { git = "https://github.com/tikv/rusoto", branch = "gh1482-s3-addr-styles" }
rusoto_s3 = { git = "https://github.com/tikv/rusoto", branch = "gh1482-s3-addr-styles" }
rusoto_sts = { git = "https://github.com/tikv/rusoto", branch = "gh1482-s3-addr-styles" }
openssl-src = { git = "https://github.com/cosven/openssl-src-rs", branch = "lonngarch64-2" }

[target.'cfg(target_os = "linux")'.dependencies]
procinfo = { git = "https://github.com/tikv/procinfo-rs", rev = "5125fc1a69496b73b26b3c08b6e8afc3c665a56e" }

[workspace]
members = [
  "fuzz",
  "fuzz/fuzzer-afl",
  "fuzz/fuzzer-libfuzzer",
  "fuzz/fuzzer-honggfuzz",
  "tests",
  "cmd",
  "components/test_raftstore",
  "components/test_storage",
  "components/test_coprocessor",
  "components/test_sst_importer",
  "components/test_util",
  "components/test_pd",
  "components/tikv_alloc",
  "components/match_template",
  "components/codec",
  "components/configuration",
  "components/panic_hook",
  "components/tipb_helper",
  "components/log_wrappers",
  "components/tikv_util",
  "components/tidb_query",
  "components/tidb_query_datatype",
  "components/tidb_query_codegen",
  "components/pd_client",
  "components/external_storage",
  "components/backup",
  "components/keys",
  "components/sst_importer",
  "components/txn_types",
  "components/resolved_ts",
  "components/batch-system",
  "components/cdc",
  "components/raftstore",
  "components/into_other",
  "components/encryption",
  "components/error_code",
]
default-members = ["cmd"]

[profile.dev]
opt-level = 0
debug = 1 # required for line numbers in tests, see tikv #5049
codegen-units = 4
lto = false
incremental = true
panic = 'unwind'
debug-assertions = true
overflow-checks = false
rpath = false

[profile.release]
opt-level = 3
debug = false
codegen-units = 1
lto = "thin"
incremental = false
panic = 'unwind'
debug-assertions = false
overflow-checks = false
rpath = false

[profile.test]
opt-level = 0
debug = 1 # enable line numbers by default for easy test debugging
codegen-units = 16
lto = false
incremental = true
debug-assertions = true
overflow-checks = true
rpath = false

# The benchmark profile is identical to release, except that lto = false
[profile.bench]
opt-level = 3
debug = false
codegen-units = 1
lto = 'thin'
incremental = false
debug-assertions = false
overflow-checks = false
rpath = false
