Removed all references to the old binary cache.
This commit is contained in:
parent
066aef6090
commit
3f960be96c
11 changed files with 12 additions and 83 deletions
|
|
@ -52,14 +52,9 @@ entry_base_t::~entry_base_t()
|
||||||
|
|
||||||
foreach (xact_t * xact, xacts) {
|
foreach (xact_t * xact, xacts) {
|
||||||
// If the transaction is a temporary, it will be destructed when the
|
// If the transaction is a temporary, it will be destructed when the
|
||||||
// temporary is. If it's from a binary cache, we can safely destruct it
|
// temporary is.
|
||||||
// but its memory will be deallocated with the cache.
|
if (! xact->has_flags(ITEM_TEMP))
|
||||||
if (! xact->has_flags(ITEM_TEMP)) {
|
|
||||||
if (! xact->has_flags(ITEM_IN_CACHE))
|
|
||||||
checked_delete(xact);
|
checked_delete(xact);
|
||||||
else
|
|
||||||
xact->~xact_t();
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,8 +46,6 @@ Basic options:\n\
|
||||||
-f, --file FILE read ledger data from FILE\n\
|
-f, --file FILE read ledger data from FILE\n\
|
||||||
-o, --output FILE write output to FILE\n\
|
-o, --output FILE write output to FILE\n\
|
||||||
-i, --init-file FILE initialize ledger using FILE (default: ~/.ledgerrc)\n\
|
-i, --init-file FILE initialize ledger using FILE (default: ~/.ledgerrc)\n\
|
||||||
--cache FILE use FILE as a binary cache when --file is not used\n\
|
|
||||||
--no-cache don't use a cache, even if it would be appropriate\n\
|
|
||||||
-a, --account NAME use NAME for the default account (useful with QIF)\n\n\
|
-a, --account NAME use NAME for the default account (useful with QIF)\n\n\
|
||||||
Commands:\n\
|
Commands:\n\
|
||||||
balance [REGEXP]... show balance totals for matching accounts\n\
|
balance [REGEXP]... show balance totals for matching accounts\n\
|
||||||
|
|
@ -135,8 +133,6 @@ Basic options:\n\
|
||||||
-f, --file FILE read ledger data from FILE\n\
|
-f, --file FILE read ledger data from FILE\n\
|
||||||
-o, --output FILE write output to FILE\n\
|
-o, --output FILE write output to FILE\n\
|
||||||
-i, --init-file FILE initialize ledger using FILE (default: ~/.ledgerrc)\n\
|
-i, --init-file FILE initialize ledger using FILE (default: ~/.ledgerrc)\n\
|
||||||
--cache FILE use FILE as a binary cache when --file is not used\n\
|
|
||||||
--no-cache don't use a cache, even if it would be appropriate\n\
|
|
||||||
-a, --account NAME use NAME for the default account (useful with QIF)\n\n\
|
-a, --account NAME use NAME for the default account (useful with QIF)\n\n\
|
||||||
Report filtering:\n\
|
Report filtering:\n\
|
||||||
-c, --current show only current and past entries (not future)\n\
|
-c, --current show only current and past entries (not future)\n\
|
||||||
|
|
|
||||||
|
|
@ -60,9 +60,8 @@ class item_t : public supports_flags<>, public scope_t
|
||||||
{
|
{
|
||||||
public:
|
public:
|
||||||
#define ITEM_NORMAL 0x00 // no flags at all, a basic transaction
|
#define ITEM_NORMAL 0x00 // no flags at all, a basic transaction
|
||||||
#define ITEM_IN_CACHE 0x01 // transaction allocated by the binary cache
|
#define ITEM_GENERATED 0x01 // transaction was not found in a journal
|
||||||
#define ITEM_GENERATED 0x02 // transaction was not found in a journal
|
#define ITEM_TEMP 0x02 // transaction is a temporary object
|
||||||
#define ITEM_TEMP 0x04 // transaction is a temporary object
|
|
||||||
|
|
||||||
enum state_t { UNCLEARED = 0, CLEARED, PENDING };
|
enum state_t { UNCLEARED = 0, CLEARED, PENDING };
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -44,22 +44,13 @@ journal_t::~journal_t()
|
||||||
// accounts they refer to, because all accounts are about to
|
// accounts they refer to, because all accounts are about to
|
||||||
// be deleted.
|
// be deleted.
|
||||||
foreach (entry_t * entry, entries)
|
foreach (entry_t * entry, entries)
|
||||||
if (! entry->has_flags(ITEM_IN_CACHE))
|
|
||||||
checked_delete(entry);
|
checked_delete(entry);
|
||||||
else
|
|
||||||
entry->~entry_t();
|
|
||||||
|
|
||||||
foreach (auto_entry_t * entry, auto_entries)
|
foreach (auto_entry_t * entry, auto_entries)
|
||||||
if (! entry->has_flags(ITEM_IN_CACHE))
|
|
||||||
checked_delete(entry);
|
checked_delete(entry);
|
||||||
else
|
|
||||||
entry->~auto_entry_t();
|
|
||||||
|
|
||||||
foreach (period_entry_t * entry, period_entries)
|
foreach (period_entry_t * entry, period_entries)
|
||||||
if (! entry->has_flags(ITEM_IN_CACHE))
|
|
||||||
checked_delete(entry);
|
checked_delete(entry);
|
||||||
else
|
|
||||||
entry->~period_entry_t();
|
|
||||||
}
|
}
|
||||||
|
|
||||||
void journal_t::add_account(account_t * acct)
|
void journal_t::add_account(account_t * acct)
|
||||||
|
|
|
||||||
|
|
@ -62,8 +62,6 @@
|
||||||
*
|
*
|
||||||
* \section invoke_cmd Invoke the command object
|
* \section invoke_cmd Invoke the command object
|
||||||
*
|
*
|
||||||
* \section write_cache Write out binary cache file, if necessary
|
|
||||||
*
|
|
||||||
* \section shutdown Wrap up, closing everything and releasing memory
|
* \section shutdown Wrap up, closing everything and releasing memory
|
||||||
*/
|
*/
|
||||||
#ifndef _LEDGER_H
|
#ifndef _LEDGER_H
|
||||||
|
|
|
||||||
|
|
@ -87,7 +87,6 @@ void quotes_by_script::operator()(commodity_base_t& commodity,
|
||||||
commodity.add_price(current_moment, price);
|
commodity.add_price(current_moment, price);
|
||||||
|
|
||||||
commodity.history->last_lookup = current_moment;
|
commodity.history->last_lookup = current_moment;
|
||||||
cache_dirty = true;
|
|
||||||
|
|
||||||
if (price && ! price_db.empty()) {
|
if (price && ! price_db.empty()) {
|
||||||
#if defined(__GNUG__) && __GNUG__ < 3
|
#if defined(__GNUG__) && __GNUG__ < 3
|
||||||
|
|
|
||||||
|
|
@ -60,16 +60,13 @@ class quotes_by_script : public noncopyable, public commodity_t::base_t::updater
|
||||||
{
|
{
|
||||||
string price_db;
|
string price_db;
|
||||||
std::size_t pricing_leeway;
|
std::size_t pricing_leeway;
|
||||||
bool& cache_dirty;
|
|
||||||
|
|
||||||
quotes_by_script();
|
quotes_by_script();
|
||||||
|
|
||||||
public:
|
public:
|
||||||
quotes_by_script(path _price_db,
|
quotes_by_script(path _price_db,
|
||||||
std::size_t _pricing_leeway,
|
std::size_t _pricing_leeway)
|
||||||
bool& _cache_dirty)
|
: price_db(_price_db), pricing_leeway(_pricing_leeway) {
|
||||||
: price_db(_price_db), pricing_leeway(_pricing_leeway),
|
|
||||||
cache_dirty(_cache_dirty) {
|
|
||||||
TRACE_CTOR(quotes_by_script, "path, std::size_t, bool&");
|
TRACE_CTOR(quotes_by_script, "path, std::size_t, bool&");
|
||||||
}
|
}
|
||||||
~quotes_by_script() throw() {
|
~quotes_by_script() throw() {
|
||||||
|
|
|
||||||
|
|
@ -250,14 +250,6 @@ public:
|
||||||
"The init file '" << path << "' does not exist or is not readable");
|
"The init file '" << path << "' does not exist or is not readable");
|
||||||
}
|
}
|
||||||
|
|
||||||
value_t option_cache(call_scope_t& args) { // :
|
|
||||||
config->cache_file = resolve_path(optarg);
|
|
||||||
}
|
|
||||||
|
|
||||||
value_t option_no_cache(call_scope_t& args) {
|
|
||||||
config->cache_file = "<none>";
|
|
||||||
}
|
|
||||||
|
|
||||||
value_t option_output(call_scope_t& args) { // o:
|
value_t option_output(call_scope_t& args) { // o:
|
||||||
if (std::string(optarg) != "-") {
|
if (std::string(optarg) != "-") {
|
||||||
std::string path = resolve_path(optarg);
|
std::string path = resolve_path(optarg);
|
||||||
|
|
|
||||||
|
|
@ -103,8 +103,6 @@ session_t::session_t()
|
||||||
current_year(CURRENT_DATE().year()),
|
current_year(CURRENT_DATE().year()),
|
||||||
|
|
||||||
download_quotes(false),
|
download_quotes(false),
|
||||||
use_cache(true),
|
|
||||||
cache_dirty(false),
|
|
||||||
|
|
||||||
#if 0
|
#if 0
|
||||||
elision_style(ABBREVIATE),
|
elision_style(ABBREVIATE),
|
||||||
|
|
@ -125,7 +123,6 @@ session_t::session_t()
|
||||||
|
|
||||||
init_file = home ? *home / ".ledgerrc" : "./.ledgerrc";
|
init_file = home ? *home / ".ledgerrc" : "./.ledgerrc";
|
||||||
price_db = home ? *home / ".pricedb" : "./.pricedb";
|
price_db = home ? *home / ".pricedb" : "./.pricedb";
|
||||||
cache_file = home ? *home / ".ledger-cache" : "./.ledger-cache";
|
|
||||||
|
|
||||||
register_parser(new textual_parser_t);
|
register_parser(new textual_parser_t);
|
||||||
|
|
||||||
|
|
@ -205,21 +202,6 @@ std::size_t session_t::read_data(journal_t& journal,
|
||||||
|
|
||||||
std::size_t entry_count = 0;
|
std::size_t entry_count = 0;
|
||||||
|
|
||||||
DEBUG("ledger.cache", "3. use_cache = " << use_cache);
|
|
||||||
|
|
||||||
if (use_cache && cache_file) {
|
|
||||||
DEBUG("ledger.cache", "using_cache " << cache_file->string());
|
|
||||||
cache_dirty = true;
|
|
||||||
if (exists(*cache_file)) {
|
|
||||||
push_variable<optional<path> >
|
|
||||||
save_price_db(journal.price_db, price_db);
|
|
||||||
|
|
||||||
entry_count += read_journal(journal, *cache_file);
|
|
||||||
if (entry_count > 0)
|
|
||||||
cache_dirty = false;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (entry_count == 0) {
|
if (entry_count == 0) {
|
||||||
account_t * acct = journal.master;
|
account_t * acct = journal.master;
|
||||||
if (! master_account.empty())
|
if (! master_account.empty())
|
||||||
|
|
@ -230,17 +212,13 @@ std::size_t session_t::read_data(journal_t& journal,
|
||||||
if (read_journal(journal, *journal.price_db)) {
|
if (read_journal(journal, *journal.price_db)) {
|
||||||
throw_(parse_error, "Entries not allowed in price history file");
|
throw_(parse_error, "Entries not allowed in price history file");
|
||||||
} else {
|
} else {
|
||||||
DEBUG("ledger.cache",
|
|
||||||
"read price database " << journal.price_db->string());
|
|
||||||
journal.sources.pop_back();
|
journal.sources.pop_back();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
foreach (const path& pathname, data_files) {
|
foreach (const path& pathname, data_files) {
|
||||||
DEBUG("ledger.cache", "rejected cache, parsing " << pathname.string());
|
|
||||||
if (pathname == "-") {
|
if (pathname == "-") {
|
||||||
use_cache = false;
|
|
||||||
journal.sources.push_back("/dev/stdin");
|
journal.sources.push_back("/dev/stdin");
|
||||||
|
|
||||||
// To avoid problems with stdin and pipes, etc., we read the entire
|
// To avoid problems with stdin and pipes, etc., we read the entire
|
||||||
|
|
|
||||||
|
|
@ -69,7 +69,6 @@ public:
|
||||||
bool next_data_file_from_command_line;
|
bool next_data_file_from_command_line;
|
||||||
bool saw_data_file_from_command_line;
|
bool saw_data_file_from_command_line;
|
||||||
optional<path> init_file;
|
optional<path> init_file;
|
||||||
optional<path> cache_file;
|
|
||||||
optional<path> price_db;
|
optional<path> price_db;
|
||||||
optional<path> pager_path;
|
optional<path> pager_path;
|
||||||
bool next_price_db_from_command_line;
|
bool next_price_db_from_command_line;
|
||||||
|
|
@ -91,8 +90,6 @@ public:
|
||||||
int current_year;
|
int current_year;
|
||||||
|
|
||||||
bool download_quotes;
|
bool download_quotes;
|
||||||
bool use_cache;
|
|
||||||
bool cache_dirty;
|
|
||||||
|
|
||||||
format_t::elision_style_t elision_style;
|
format_t::elision_style_t elision_style;
|
||||||
int abbrev_length;
|
int abbrev_length;
|
||||||
|
|
@ -229,7 +226,6 @@ See LICENSE file included with the distribution for details and disclaimer.";
|
||||||
if (next_data_file_from_command_line &&
|
if (next_data_file_from_command_line &&
|
||||||
! saw_data_file_from_command_line) {
|
! saw_data_file_from_command_line) {
|
||||||
data_files.clear();
|
data_files.clear();
|
||||||
use_cache = false;
|
|
||||||
saw_data_file_from_command_line = true;
|
saw_data_file_from_command_line = true;
|
||||||
}
|
}
|
||||||
data_files.push_back(args[0].as_string());
|
data_files.push_back(args[0].as_string());
|
||||||
|
|
|
||||||
12
src/work.cc
12
src/work.cc
|
|
@ -110,18 +110,6 @@ strings_list read_command_arguments(report_t& report, strings_list args)
|
||||||
|
|
||||||
void normalize_session_options(session_t& session)
|
void normalize_session_options(session_t& session)
|
||||||
{
|
{
|
||||||
if (! session.cache_file)
|
|
||||||
session.use_cache = false;
|
|
||||||
|
|
||||||
DEBUG("ledger.session.cache", "1. use_cache = " << session.use_cache);
|
|
||||||
|
|
||||||
if (std::find(session.data_files.begin(),
|
|
||||||
session.data_files.end(), *session.cache_file) !=
|
|
||||||
session.data_files.end())
|
|
||||||
session.use_cache = false;
|
|
||||||
|
|
||||||
DEBUG("ledger.session.cache", "2. use_cache = " << session.use_cache);
|
|
||||||
|
|
||||||
INFO("Initialization file is " << session.init_file->string());
|
INFO("Initialization file is " << session.init_file->string());
|
||||||
INFO("Price database is " << session.price_db->string());
|
INFO("Price database is " << session.price_db->string());
|
||||||
|
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue