Make vitastor_kv.h header public
Test / buildenv (push) Successful in 10s Details
Test / build (push) Successful in 4m4s Details
Test / npm_lint (push) Successful in 7s Details
Test / test_cas (push) Successful in 9s Details
Test / make_test (push) Successful in 35s Details
Test / test_change_pg_size (push) Successful in 9s Details
Test / test_change_pg_count (push) Successful in 34s Details
Test / test_create_nomaxid (push) Successful in 8s Details
Test / test_change_pg_count_ec (push) Successful in 31s Details
Test / test_etcd_fail (push) Successful in 1m23s Details
Test / test_interrupted_rebalance_imm (push) Successful in 1m53s Details
Test / test_add_osd (push) Successful in 2m40s Details
Test / test_failure_domain (push) Successful in 42s Details
Test / test_interrupted_rebalance_ec (push) Successful in 1m33s Details
Test / test_interrupted_rebalance (push) Successful in 2m55s Details
Test / test_snapshot (push) Successful in 21s Details
Test / test_minsize_1 (push) Successful in 15s Details
Test / test_interrupted_rebalance_ec_imm (push) Successful in 1m27s Details
Test / test_move_reappear (push) Successful in 21s Details
Test / test_snapshot_ec (push) Successful in 28s Details
Test / test_rm (push) Successful in 14s Details
Test / test_snapshot_down (push) Successful in 25s Details
Test / test_snapshot_down_ec (push) Successful in 27s Details
Test / test_splitbrain (push) Successful in 24s Details
Test / test_snapshot_chain (push) Successful in 2m25s Details
Test / test_snapshot_chain_ec (push) Successful in 2m47s Details
Test / test_rebalance_verify_imm (push) Successful in 2m42s Details
Test / test_root_node (push) Successful in 9s Details
Test / test_rebalance_verify (push) Successful in 3m21s Details
Test / test_switch_primary (push) Successful in 37s Details
Test / test_write (push) Successful in 46s Details
Test / test_write_no_same (push) Successful in 17s Details
Test / test_write_xor (push) Successful in 49s Details
Test / test_rebalance_verify_ec (push) Successful in 4m51s Details
Test / test_rebalance_verify_ec_imm (push) Successful in 4m31s Details
Test / test_heal_pg_size_2 (push) Successful in 3m36s Details
Test / test_heal_ec (push) Successful in 3m37s Details
Test / test_heal_csum_32k_dmj (push) Successful in 6m7s Details
Test / test_heal_csum_32k_dj (push) Successful in 6m12s Details
Test / test_heal_csum_32k (push) Successful in 7m20s Details
Test / test_heal_csum_4k_dmj (push) Successful in 7m7s Details
Test / test_osd_tags (push) Successful in 19s Details
Test / test_enospc (push) Successful in 1m27s Details
Test / test_enospc_xor (push) Successful in 2m24s Details
Test / test_heal_csum_4k_dj (push) Successful in 5m42s Details
Test / test_enospc_imm (push) Successful in 1m39s Details
Test / test_heal_csum_4k (push) Successful in 6m0s Details
Test / test_scrub_zero_osd_2 (push) Successful in 47s Details
Test / test_scrub (push) Successful in 50s Details
Test / test_enospc_imm_xor (push) Successful in 1m15s Details
Test / test_scrub_xor (push) Successful in 25s Details
Test / test_nfs (push) Successful in 23s Details
Test / test_scrub_ec (push) Successful in 32s Details
Test / test_scrub_pg_size_6_pg_minsize_4_osd_count_6_ec (push) Successful in 35s Details
Test / test_scrub_pg_size_3 (push) Successful in 41s Details

antietcd
Vitaliy Filippov 2024-05-15 01:48:41 +03:00
parent ba52359611
commit 44692d148a
12 changed files with 55 additions and 25 deletions

View File

@ -196,8 +196,8 @@ endif (HAVE_NBD_NETLINK_H AND NL3_LIBRARIES)
# libvitastor_kv.so
add_library(vitastor_kv SHARED
kv_db.cpp
kv_db.h
)
set_target_properties(vitastor_kv PROPERTIES PUBLIC_HEADER "vitastor_kv.h")
target_link_libraries(vitastor_kv
vitastor_client
)

View File

@ -12,16 +12,17 @@
#include <fcntl.h>
//#include <signal.h>
#include "cluster_client.h"
#include "epoll_manager.h"
#include "str_util.h"
#include "kv_db.h"
#include "vitastor_kv.h"
const char *exe_name = NULL;
class kv_cli_t
{
public:
json11::Json::object cfg;
std::map<std::string, std::string> cfg;
std::vector<std::string> cli_cmd;
kv_dbw_t *db = NULL;
@ -156,7 +157,7 @@ void kv_cli_t::run()
if (cfg.find("db") != cfg.end())
{
bool done = false;
handle_cmd({ "open", cfg.at("db").string_value() }, [&done](int res) { if (res != 0) exit(1); done = true; });
handle_cmd({ "open", cfg.at("db") }, [&done](int res) { if (res != 0) exit(1); done = true; });
while (!done)
{
ringloop->loop();

View File

@ -15,7 +15,7 @@
#include "cluster_client.h"
#include "str_util.h"
#include "kv_db.h"
#include "vitastor_kv.h"
// 0x VITASTOR OPTBTREE
#define KV_BLOCK_MAGIC 0x761A5106097B18EE
@ -1969,12 +1969,12 @@ kv_dbw_t::~kv_dbw_t()
delete db;
}
void kv_dbw_t::open(inode_t inode_id, json11::Json cfg, std::function<void(int)> cb)
void kv_dbw_t::open(uint64_t inode_id, std::map<std::string, std::string> cfg, std::function<void(int)> cb)
{
db->open(inode_id, cfg, cb);
}
void kv_dbw_t::set_config(json11::Json cfg)
void kv_dbw_t::set_config(std::map<std::string, std::string> cfg)
{
db->set_config(cfg);
}

View File

@ -12,9 +12,10 @@
#include <fcntl.h>
//#include <signal.h>
#include "cluster_client.h"
#include "epoll_manager.h"
#include "str_util.h"
#include "kv_db.h"
#include "vitastor_kv.h"
const char *exe_name = NULL;
@ -44,7 +45,7 @@ class kv_test_t
{
public:
// Config
json11::Json::object kv_cfg;
std::map<std::string, std::string> kv_cfg;
std::string key_prefix, key_suffix;
uint64_t inode_id = 0;
uint64_t op_count = 1000000;
@ -238,22 +239,22 @@ void kv_test_t::parse_config(json11::Json cfg)
if (!cfg["stop_on_error"].is_null())
stop_on_error = cfg["stop_on_error"].bool_value();
if (!cfg["kv_block_size"].is_null())
kv_cfg["kv_block_size"] = cfg["kv_block_size"];
kv_cfg["kv_block_size"] = cfg["kv_block_size"].as_string();
if (!cfg["kv_memory_limit"].is_null())
kv_cfg["kv_memory_limit"] = cfg["kv_memory_limit"];
kv_cfg["kv_memory_limit"] = cfg["kv_memory_limit"].as_string();
if (!cfg["kv_allocate_blocks"].is_null())
kv_cfg["kv_allocate_blocks"] = cfg["kv_allocate_blocks"];
kv_cfg["kv_allocate_blocks"] = cfg["kv_allocate_blocks"].as_string();
if (!cfg["kv_evict_max_misses"].is_null())
kv_cfg["kv_evict_max_misses"] = cfg["kv_evict_max_misses"];
kv_cfg["kv_evict_max_misses"] = cfg["kv_evict_max_misses"].as_string();
if (!cfg["kv_evict_attempts_per_level"].is_null())
kv_cfg["kv_evict_attempts_per_level"] = cfg["kv_evict_attempts_per_level"];
kv_cfg["kv_evict_attempts_per_level"] = cfg["kv_evict_attempts_per_level"].as_string();
if (!cfg["kv_evict_unused_age"].is_null())
kv_cfg["kv_evict_unused_age"] = cfg["kv_evict_unused_age"];
kv_cfg["kv_evict_unused_age"] = cfg["kv_evict_unused_age"].as_string();
if (!cfg["kv_log_level"].is_null())
{
log_level = cfg["kv_log_level"].uint64_value();
trace = log_level >= 10;
kv_cfg["kv_log_level"] = cfg["kv_log_level"];
kv_cfg["kv_log_level"] = std::to_string(log_level);
}
total_prob = reopen_prob+get_prob+add_prob+update_prob+del_prob+list_prob;
stat.get.name = "get";

View File

@ -2,6 +2,8 @@
// License: VNPL-1.1 (see README.md for details)
//
// NFS proxy over Vitastor block images
// Presents all images as files
// Keeps image/file list in memory and is thus unsuitable for a large number of files
#include <sys/time.h>

View File

@ -2,6 +2,8 @@
// License: VNPL-1.1 (see README.md for details)
//
// NFS proxy over Vitastor block images - header
// Presents all images as files
// Keeps image/file list in memory and is thus unsuitable for a large number of files
#pragma once

View File

@ -256,7 +256,12 @@ void kv_fs_state_t::init(nfs_proxy_t *proxy, json11::Json cfg)
int open_res = 0;
bool open_done = false;
proxy->db = new kv_dbw_t(proxy->cli);
proxy->db->open(fs_kv_inode, cfg, [&](int res)
std::map<std::string, std::string> kv_cfg;
for (auto & kv: cfg.object_items())
{
kv_cfg[kv.first] = kv.second.as_string();
}
proxy->db->open(fs_kv_inode, kv_cfg, [&](int res)
{
open_done = true;
open_res = res;

View File

@ -1,9 +1,7 @@
// Copyright (c) Vitaliy Filippov, 2019+
// License: VNPL-1.1 (see README.md for details)
//
// Simplified NFS proxy
// Presents all images as files
// Keeps image/file list in memory and is thus unsuitable for a large number of files
// NFS proxy entrypoint, common for both pseudo-FS and Vitastor-KV based FS
#define _XOPEN_SOURCE
#include <limits.h>

View File

@ -1,10 +1,15 @@
// Copyright (c) Vitaliy Filippov, 2019+
// License: VNPL-1.1 (see README.md for details)
//
// Simplified NFS proxy - main entrypoint header
#pragma once
#include "cluster_client.h"
#include "epoll_manager.h"
#include "nfs_portmap.h"
#include "nfs/xdr_impl.h"
#include "kv_db.h"
#include "vitastor_kv.h"
#define NFS_ROOT_HANDLE "R"
#define RPC_INIT_BUF_SIZE 32768

View File

@ -200,6 +200,11 @@ vitastor_c *vitastor_c_create_epoll_json(const char **options, int options_len)
return self;
}
void* vitastor_c_get_internal_client(vitastor_c *client)
{
return client->cli;
}
void vitastor_c_destroy(vitastor_c *client)
{
delete client->cli;

View File

@ -7,7 +7,7 @@
#define VITASTOR_QEMU_PROXY_H
// C API wrapper version
#define VITASTOR_C_API_VERSION 3
#define VITASTOR_C_API_VERSION 4
#ifndef POOL_ID_BITS
#define POOL_ID_BITS 16
@ -41,6 +41,7 @@ vitastor_c *vitastor_c_create_uring(const char *config_path, const char *etcd_ho
int use_rdma, const char *rdma_device, int rdma_port_num, int rdma_gid_index, int rdma_mtu, int log_level);
vitastor_c *vitastor_c_create_uring_json(const char **options, int options_len);
vitastor_c *vitastor_c_create_epoll_json(const char **options, int options_len);
void* vitastor_c_get_internal_client(vitastor_c *client);
void vitastor_c_destroy(vitastor_c *client);
int vitastor_c_is_ready(vitastor_c *client);
int vitastor_c_uring_register_eventfd(vitastor_c *client);

View File

@ -6,17 +6,27 @@
#pragma once
#include "cluster_client.h"
#include <stdint.h>
#include <sys/uio.h>
#include <string>
#include <map>
#include <functional>
#define VITASTOR_KV_API_VERSION 1
class cluster_client_t;
struct kv_db_t;
struct kv_dbw_t
{
// cli = vitastor_c_get_internal_client(client)
kv_dbw_t(cluster_client_t *cli);
~kv_dbw_t();
void open(inode_t inode_id, json11::Json cfg, std::function<void(int)> cb);
void set_config(json11::Json cfg);
void open(uint64_t inode_id, std::map<std::string, std::string> cfg, std::function<void(int)> cb);
void set_config(std::map<std::string, std::string> cfg);
void close(std::function<void()> cb);
uint64_t get_size();