提交 a25a7a24 编写于 作者: X xj.lin

add db setting file


Former-commit-id: 184bf9c48a5b659a85a11b09aa694165ee6b7b61
上级 d126d3a7
////////////////////////////////////////////////////////////////////////////////
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
// Unauthorized copying of this file, via any medium is strictly prohibited.
// Proprietary and confidential.
////////////////////////////////////////////////////////////////////////////////
#include "db_connection.h"
#include <string>
#include <iostream>
#include <thread>
namespace zilliz {
namespace vecwise {
namespace engine {
using std::cout;
using std::endl;
using std::string;
string storage_file_name = "default.sqlite"
DbPtr connect() {
DbPtr temp = std::make_shared<SqliteDB>(initStorage(storage_file_name));
temp->sync_schema();
temp->open_forever(); // thread safe option
temp->pragma.journal_mode(journal_mode::WAL); // WAL => write ahead log
return temp;
}
SqliteDBPtr Connection::connect_ = connect();
}
}
}
////////////////////////////////////////////////////////////////////////////////
// Copyright 上海赜睿信息科技有限公司(Zilliz) - All Rights Reserved
// Unauthorized copying of this file, via any medium is strictly prohibited.
// Proprietary and confidential.
////////////////////////////////////////////////////////////////////////////////
#pragma once
namespace zilliz {
namespace vecwise {
namespace engine {
struct GroupSchema {
size_t id;
std::string group_id;
size_t files_cnt = 0;
uint16_t dimension;
std::string location = "";
std::string next_file_location = "";
}; // GroupSchema
struct GroupFileSchema {
typedef enum {
RAW,
INDEX
} FILE_TYPE;
size_t id;
std::string group_id;
std::string file_id;
int files_type = RAW;
size_t rows;
std::string location = "";
}; // GroupFileSchema
inline auto initStorage(const std::string &path) {
return make_storage(path,
make_table("COMPANY",
make_column("ID", &Employee::id, primary_key()),
make_column("AGE", &Employee::age)));
}
using SqliteDB = decltype(initStorage(""));
using SqliteDBPtr= std::shared_ptr<Db>;
class Connection {
protected:
static SqliteDBPtr connect_;
};
}
}
}
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册