summaryrefslogtreecommitdiff
path: root/cpp/src/Freeze/ObjectStore.cpp
diff options
context:
space:
mode:
Diffstat (limited to 'cpp/src/Freeze/ObjectStore.cpp')
-rw-r--r--cpp/src/Freeze/ObjectStore.cpp34
1 files changed, 23 insertions, 11 deletions
diff --git a/cpp/src/Freeze/ObjectStore.cpp b/cpp/src/Freeze/ObjectStore.cpp
index 899840b62a8..4015ab63eb5 100644
--- a/cpp/src/Freeze/ObjectStore.cpp
+++ b/cpp/src/Freeze/ObjectStore.cpp
@@ -29,7 +29,8 @@ Freeze::ObjectStoreBase::ObjectStoreBase(const string& facet, const string& face
_evictor(evictor),
_indices(indices),
_communicator(evictor->communicator()),
- _encoding(evictor->encoding())
+ _encoding(evictor->encoding()),
+ _keepStats(false)
{
if(facet == "")
{
@@ -60,10 +61,17 @@ Freeze::ObjectStoreBase::ObjectStoreBase(const string& facet, const string& face
Catalog::iterator p = catalog.find(evictor->filename());
if(p != catalog.end())
{
- if(p->second.evictor == false)
+ if(p->second.evictor)
+ {
+ //
+ // empty means the value is ::Freeze::ObjectRecord
+ //
+ _keepStats = p->second.value.empty();
+ }
+ else
{
DatabaseException ex(__FILE__, __LINE__);
- ex.message = evictor->filename() + " is an evictor database";
+ ex.message = evictor->filename() + " is not an evictor database";
throw ex;
}
}
@@ -141,6 +149,8 @@ Freeze::ObjectStoreBase::ObjectStoreBase(const string& facet, const string& face
{
CatalogData catalogData;
catalogData.evictor = true;
+ catalogData.key = "Ice::Identity";
+ catalogData.value = "Object";
catalog.put(Catalog::value_type(evictor->filename(), catalogData));
}
@@ -348,12 +358,13 @@ void
Freeze::ObjectStoreBase::marshal(const ObjectRecord& v,
Value& bytes,
const CommunicatorPtr& communicator,
- const EncodingVersion& encoding)
+ const EncodingVersion& encoding,
+ bool keepStats)
{
IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);
IceInternal::BasicStream stream(instance.get(), encoding, true);
stream.startWriteEncaps();
- if(encoding == Ice::Encoding_1_0)
+ if(keepStats)
{
v.__write(&stream);
}
@@ -371,7 +382,8 @@ void
Freeze::ObjectStoreBase::unmarshal(ObjectRecord& v,
const Value& bytes,
const CommunicatorPtr& communicator,
- const EncodingVersion& encoding)
+ const EncodingVersion& encoding,
+ bool keepStats)
{
IceInternal::InstancePtr instance = IceInternal::getInstance(communicator);
IceInternal::BasicStream stream(instance.get(), encoding, true);
@@ -381,7 +393,7 @@ Freeze::ObjectStoreBase::unmarshal(ObjectRecord& v,
stream.i = stream.b.begin();
stream.startReadEncaps();
- if(encoding == Ice::Encoding_1_0)
+ if(keepStats)
{
v.__read(&stream);
}
@@ -453,7 +465,7 @@ Freeze::ObjectStoreBase::load(const Identity& ident, const TransactionIPtr& tran
}
}
- unmarshal(rec, value, _communicator, _encoding);
+ unmarshal(rec, value, _communicator, _encoding, _keepStats);
_evictor->initialize(ident, _facet, rec.servant);
return true;
}
@@ -477,7 +489,7 @@ Freeze::ObjectStoreBase::update(const Identity& ident, const ObjectRecord& rec,
marshal(ident, key, _communicator, _encoding);
Value value;
- marshal(rec, value, _communicator, _encoding);
+ marshal(rec, value, _communicator, _encoding, _keepStats);
Dbt dbKey;
Dbt dbValue;
@@ -522,7 +534,7 @@ Freeze::ObjectStoreBase::insert(const Identity& ident, const ObjectRecord& rec,
marshal(ident, key, _communicator, _encoding);
Value value;
- marshal(rec, value, _communicator, _encoding);
+ marshal(rec, value, _communicator, _encoding, _keepStats);
Dbt dbKey;
Dbt dbValue;
@@ -670,7 +682,7 @@ Freeze::ObjectStoreBase::loadImpl(const Identity& ident, ObjectRecord& rec)
}
}
- unmarshal(rec, value, _communicator, _encoding);
+ unmarshal(rec, value, _communicator, _encoding, _keepStats);
_evictor->initialize(ident, _facet, rec.servant);
return true;
}