Merge remote-tracking branch 'remotes/origin/topic/robin/broccoli-connrec'

* remotes/origin/topic/robin/broccoli-connrec:
  Adapting attribute serialization when talking to Broccoli.
This commit is contained in:
Robin Sommer 2011-12-03 15:57:19 -08:00
commit b449d5652d
6 changed files with 36 additions and 3 deletions

View file

@ -1,4 +1,9 @@
2.0-beta-94 | 2011-12-03 15:57:19 -0800
* Adapting attribute serialization when talking to Broccoli. (Robin
Sommer)
2.0-beta-92 | 2011-12-03 15:56:03 -0800
* Changes to Broxygen master script package index. (Jon Siwek)

View file

@ -1 +1 @@
2.0-beta-92
2.0-beta-94

View file

@ -481,7 +481,11 @@ bool Attributes::DoSerialize(SerialInfo* info) const
loop_over_list((*attrs), i)
{
Attr* a = (*attrs)[i];
SERIALIZE_OPTIONAL(a->AttrExpr())
// Broccoli doesn't support expressions.
Expr* e = (! info->broccoli_peer) ? a->AttrExpr() : 0;
SERIALIZE_OPTIONAL(e);
if ( ! SERIALIZE(char(a->Tag())) )
return false;
}

View file

@ -385,6 +385,9 @@ inline void RemoteSerializer::SetupSerialInfo(SerialInfo* info, Peer* peer)
peer->phase == Peer::RUNNING )
info->new_cache_strategy = true;
if ( (peer->caps & Peer::BROCCOLI_PEER) )
info->broccoli_peer = true;
info->include_locations = false;
}
@ -2113,6 +2116,9 @@ bool RemoteSerializer::HandshakeDone(Peer* peer)
if ( (peer->caps & Peer::NEW_CACHE_STRATEGY) )
Log(LogInfo, "peer supports keep-in-cache; using that", peer);
if ( (peer->caps & Peer::BROCCOLI_PEER) )
Log(LogInfo, "peer is a Broccoli", peer);
if ( peer->logs_requested )
log_mgr->SendAllWritersTo(peer->id);
@ -2365,6 +2371,9 @@ bool RemoteSerializer::ProcessSerialization()
current_peer->phase == Peer::RUNNING )
info.new_cache_strategy = true;
if ( current_peer->caps & Peer::BROCCOLI_PEER )
info.broccoli_peer = true;
if ( ! forward_remote_state_changes )
ignore_accesses = true;

View file

@ -198,6 +198,7 @@ protected:
static const int NO_CACHING = 2;
static const int PID_64BIT = 4;
static const int NEW_CACHE_STRATEGY = 8;
static const int BROCCOLI_PEER = 16;
// Constants to remember to who did something.
static const int NONE = 0;

View file

@ -15,6 +15,7 @@ public:
pid_32bit = false;
include_locations = true;
new_cache_strategy = false;
broccoli_peer = false;
}
SerialInfo(const SerialInfo& info)
@ -28,6 +29,7 @@ public:
pid_32bit = info.pid_32bit;
include_locations = info.include_locations;
new_cache_strategy = info.new_cache_strategy;
broccoli_peer = info.broccoli_peer;
}
// Parameters that control serialization.
@ -46,6 +48,11 @@ public:
// If true, we support keeping objs in cache permanently.
bool new_cache_strategy;
// If true, we're connecting to a Broccoli. If so, serialization
// specifics may be adapted for functionality Broccoli does not
// support.
bool broccoli_peer;
ChunkedIO::Chunk* chunk; // chunk written right before the serialization
// Attributes set during serialization.
@ -70,6 +77,7 @@ public:
print = 0;
pid_32bit = false;
new_cache_strategy = false;
broccoli_peer = false;
}
UnserialInfo(const UnserialInfo& info)
@ -86,6 +94,7 @@ public:
print = info.print;
pid_32bit = info.pid_32bit;
new_cache_strategy = info.new_cache_strategy;
broccoli_peer = info.broccoli_peer;
}
// Parameters that control unserialization.
@ -106,6 +115,11 @@ public:
// If true, we support keeping objs in cache permanently.
bool new_cache_strategy;
// If true, we're connecting to a Broccoli. If so, serialization
// specifics may be adapted for functionality Broccoli does not
// support.
bool broccoli_peer;
// If a global ID already exits, of these policies is used.
enum {
Keep, // keep the old ID and ignore the new