Nonlib: Add (some) support for opening sessions readonly.
This commit is contained in:
parent
3756dea1d6
commit
4f4698a12c
|
@ -44,6 +44,7 @@ using std::max;
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
bool Loggable::_readonly = false;
|
||||||
FILE *Loggable::_fp;
|
FILE *Loggable::_fp;
|
||||||
unsigned int Loggable::_log_id = 0;
|
unsigned int Loggable::_log_id = 0;
|
||||||
int Loggable::_level = 0;
|
int Loggable::_level = 0;
|
||||||
|
@ -116,8 +117,19 @@ Loggable::open ( const char *filename )
|
||||||
if ( ! ( fp = fopen( filename, "a+" ) ) )
|
if ( ! ( fp = fopen( filename, "a+" ) ) )
|
||||||
{
|
{
|
||||||
WARNING( "Could not open log file for writing!" );
|
WARNING( "Could not open log file for writing!" );
|
||||||
|
|
||||||
|
if ( ! ( fp = fopen( filename, "r" ) ) )
|
||||||
|
{
|
||||||
|
WARNING( "Could not open log file for reading!" );
|
||||||
return false;
|
return false;
|
||||||
}
|
}
|
||||||
|
else
|
||||||
|
{
|
||||||
|
_readonly = true;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
_readonly = false;
|
||||||
|
|
||||||
load_unjournaled_state();
|
load_unjournaled_state();
|
||||||
|
|
||||||
|
|
|
@ -70,6 +70,7 @@ class Loggable
|
||||||
Log_Entry * unjournaled_state;
|
Log_Entry * unjournaled_state;
|
||||||
};
|
};
|
||||||
|
|
||||||
|
static bool _readonly;
|
||||||
static FILE *_fp;
|
static FILE *_fp;
|
||||||
static unsigned int _log_id;
|
static unsigned int _log_id;
|
||||||
static int _level;
|
static int _level;
|
||||||
|
@ -142,6 +143,8 @@ private:
|
||||||
|
|
||||||
public:
|
public:
|
||||||
|
|
||||||
|
static bool readonly ( void ) { return _readonly; }
|
||||||
|
|
||||||
static bool replay ( const char *name );
|
static bool replay ( const char *name );
|
||||||
|
|
||||||
static bool snapshot( FILE * fp );
|
static bool snapshot( FILE * fp );
|
||||||
|
|
Loading…
Reference in New Issue