Joedb
10.4.6
The Journal-Only Embedded Database
Loading...
Searching...
No Matches
src
joedb
ui
File_Connection_Builder.h
Go to the documentation of this file.
1
#ifndef joedb_File_Connection_Builder_declared
2
#define joedb_File_Connection_Builder_declared
3
4
#include "
joedb/ui/Connection_Builder.h
"
5
#include "
joedb/ui/File_Parser.h
"
6
#include "
joedb/concurrency/File_Connection.h
"
7
8
namespace
joedb
9
{
10
/// @ingroup ui
11
class
File_Connection_Builder
:
public
Connection_Builder
12
{
13
private
:
14
File_Parser
file_parser;
15
std::optional<Readonly_Journal> readonly_journal;
16
std::optional<Writable_Journal> writable_journal;
17
std::unique_ptr<Connection> connection;
18
19
public
:
20
const
char
*
get_name
()
const override
{
return
"file"
;}
21
22
std::string
get_parameters_description
()
const override
23
{
24
return
"<file>"
;
25
}
26
27
Connection
*
build
28
(
29
Logger
&logger,
30
Arguments
&arguments,
31
Abstract_File
*file
32
)
override
33
{
34
if
(file_parser.parse(logger, arguments))
35
{
36
if
(file_parser.get_file()->is_readonly())
37
{
38
readonly_journal.emplace(*file_parser.get_file());
39
connection.reset(
new
Pullonly_Journal_Connection
(*readonly_journal));
40
}
41
else
42
{
43
writable_journal.emplace(*file_parser.get_file());
44
connection.reset(
new
Journal_Connection
(*writable_journal));
45
}
46
}
47
48
return
connection.get();
49
}
50
};
51
}
52
53
#endif
Connection_Builder.h
File_Connection.h
File_Parser.h
joedb::Abstract_File
Definition
Abstract_File.h:15
joedb::Arguments
Class for conveniently parsing command-line arguments.
Definition
Arguments.h:16
joedb::Connection_Builder
Definition
Connection_Builder.h:14
joedb::Connection
Definition
Connection.h:49
joedb::File_Connection_Builder
Definition
File_Connection_Builder.h:12
joedb::File_Connection_Builder::get_parameters_description
std::string get_parameters_description() const override
Definition
File_Connection_Builder.h:22
joedb::File_Connection_Builder::build
Connection * build(Logger &logger, Arguments &arguments, Abstract_File *file) override
Definition
File_Connection_Builder.h:28
joedb::File_Connection_Builder::get_name
const char * get_name() const override
Definition
File_Connection_Builder.h:20
joedb::File_Parser
Create an instance of a Abstract_File by parsing command-line arguments.
Definition
File_Parser.h:22
joedb::Journal_Connection
Definition
File_Connection.h:45
joedb::Logger
Definition
Logger.h:10
joedb::Pullonly_Journal_Connection
Definition
File_Connection.h:10
joedb
Definition
Server.cpp:10
Generated by
1.15.0