diff options
Diffstat (limited to 'cpp/src')
-rw-r--r-- | cpp/src/Freeze/EvictorI.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Glacier/Blobject.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Glacier/Missive.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Ice/Incoming.cpp | 2 | ||||
-rw-r--r-- | cpp/src/Ice/Outgoing.cpp | 4 | ||||
-rw-r--r-- | cpp/src/Ice/Proxy.cpp | 18 | ||||
-rw-r--r-- | cpp/src/Ice/TraceUtil.cpp | 6 | ||||
-rw-r--r-- | cpp/src/IceStorm/IceStormInternal.ice | 8 | ||||
-rw-r--r-- | cpp/src/IceStorm/LinkSubscriber.cpp | 2 | ||||
-rw-r--r-- | cpp/src/IceStorm/OnewaySubscriber.cpp | 2 | ||||
-rw-r--r-- | cpp/src/IceStorm/Subscriber.h | 2 | ||||
-rw-r--r-- | cpp/src/IceStorm/TopicI.cpp | 6 | ||||
-rw-r--r-- | cpp/src/Slice/Grammar.y | 34 | ||||
-rw-r--r-- | cpp/src/Slice/Parser.cpp | 22 | ||||
-rw-r--r-- | cpp/src/Slice/Scanner.l | 1 | ||||
-rw-r--r-- | cpp/src/slice2cpp/Gen.cpp | 6 | ||||
-rw-r--r-- | cpp/src/slice2java/Gen.cpp | 6 |
17 files changed, 86 insertions, 47 deletions
diff --git a/cpp/src/Freeze/EvictorI.cpp b/cpp/src/Freeze/EvictorI.cpp index 9744072f18c..62b40db1f59 100644 --- a/cpp/src/Freeze/EvictorI.cpp +++ b/cpp/src/Freeze/EvictorI.cpp @@ -319,7 +319,7 @@ Freeze::EvictorI::finished(const ObjectAdapterPtr&, const Current& current, // if(_persistenceMode == SaveAfterMutatingOperation) { - if(!current.isNonmutating) + if(!current.isIdempotent) { _dict.insert(make_pair(current.id, servant)); } diff --git a/cpp/src/Glacier/Blobject.cpp b/cpp/src/Glacier/Blobject.cpp index b584f5c4018..66ddf171e98 100644 --- a/cpp/src/Glacier/Blobject.cpp +++ b/cpp/src/Glacier/Blobject.cpp @@ -74,16 +74,16 @@ Glacier::Blobject::invoke(ObjectPrx& proxy, const vector<Byte>& inParams, vector out << "routing to:\n" << "proxy = " << _communicator->proxyToString(proxy) << '\n' << "operation = " << current.operation << '\n' - << "nonmutating = " << (current.isNonmutating ? "true" : "false"); + << "idempotent = " << (current.isIdempotent ? "true" : "false"); } if(_forwardContext) { - return proxy->ice_invoke(current.operation, current.isNonmutating, inParams, outParams, current.ctx); + return proxy->ice_invoke(current.operation, current.isIdempotent, inParams, outParams, current.ctx); } else { - return proxy->ice_invoke(current.operation, current.isNonmutating, inParams, outParams); + return proxy->ice_invoke(current.operation, current.isIdempotent, inParams, outParams); } } } diff --git a/cpp/src/Glacier/Missive.cpp b/cpp/src/Glacier/Missive.cpp index ca3351850d4..531ccb3e456 100644 --- a/cpp/src/Glacier/Missive.cpp +++ b/cpp/src/Glacier/Missive.cpp @@ -34,11 +34,11 @@ Glacier::Missive::invoke() std::vector<Byte> dummy; if(_forwardContext) { - _proxy->ice_invoke(_current.operation, _current.isNonmutating, _inParams, dummy, _current.ctx); + _proxy->ice_invoke(_current.operation, _current.isIdempotent, _inParams, dummy, _current.ctx); } else { - _proxy->ice_invoke(_current.operation, _current.isNonmutating, _inParams, dummy); + _proxy->ice_invoke(_current.operation, _current.isIdempotent, _inParams, dummy); } } @@ -161,7 +161,7 @@ Glacier::MissiveQueue::run() out << "batch routing to:\n" << "proxy = " << _communicator->proxyToString(proxy) << '\n' << "operation = " << current.operation << '\n' - << "isNonmutating = " << (current.isNonmutating ? "true" : "false"); + << "isIdempotent = " << (current.isIdempotent ? "true" : "false"); } (*p)->invoke(); diff --git a/cpp/src/Ice/Incoming.cpp b/cpp/src/Ice/Incoming.cpp index d077da7bac2..8275c43ed4c 100644 --- a/cpp/src/Ice/Incoming.cpp +++ b/cpp/src/Ice/Incoming.cpp @@ -32,7 +32,7 @@ IceInternal::Incoming::invoke(bool response) current.id.__read(&_is); _is.read(current.facet); _is.read(current.operation); - _is.read(current.isNonmutating); + _is.read(current.isIdempotent); Int sz; _is.readSize(sz); while(sz--) diff --git a/cpp/src/Ice/Outgoing.cpp b/cpp/src/Ice/Outgoing.cpp index fa12d0f38f4..f02cc10e07a 100644 --- a/cpp/src/Ice/Outgoing.cpp +++ b/cpp/src/Ice/Outgoing.cpp @@ -37,7 +37,7 @@ IceInternal::NonRepeatable::get() const } IceInternal::Outgoing::Outgoing(const ConnectionPtr& connection, const ReferencePtr& ref, const string& operation, - bool nonmutating, const Context& context) : + bool isIdempotent, const Context& context) : _connection(connection), _reference(ref), _state(StateUnsent), @@ -65,7 +65,7 @@ IceInternal::Outgoing::Outgoing(const ConnectionPtr& connection, const Reference _reference->identity.__write(&_os); _os.write(_reference->facet); _os.write(operation); - _os.write(nonmutating); + _os.write(isIdempotent); _os.writeSize(Int(context.size())); Context::const_iterator p; for(p = context.begin(); p != context.end(); ++p) diff --git a/cpp/src/Ice/Proxy.cpp b/cpp/src/Ice/Proxy.cpp index e63615c0d8a..6e48eaccff3 100644 --- a/cpp/src/Ice/Proxy.cpp +++ b/cpp/src/Ice/Proxy.cpp @@ -249,7 +249,7 @@ IceProxy::Ice::Object::ice_facets(const Context& __context) bool IceProxy::Ice::Object::ice_invoke(const string& operation, - bool nonmutating, + bool isIdempotent, const vector<Byte>& inParams, vector<Byte>& outParams, const Context& context) @@ -260,7 +260,7 @@ IceProxy::Ice::Object::ice_invoke(const string& operation, try { Handle< ::IceDelegate::Ice::Object> __del = __getDelegate(); - return __del->ice_invoke(operation, nonmutating, inParams, outParams, context); + return __del->ice_invoke(operation, isIdempotent, inParams, outParams, context); } catch(const LocationForward& __ex) { @@ -268,7 +268,7 @@ IceProxy::Ice::Object::ice_invoke(const string& operation, } catch(const NonRepeatable& __ex) { - if(nonmutating) + if(isIdempotent) { __handleException(*__ex.get(), __cnt); } @@ -817,12 +817,12 @@ IceDelegateM::Ice::Object::ice_facets(const Context& __context) bool IceDelegateM::Ice::Object::ice_invoke(const string& operation, - bool nonmutating, + bool isIdempotent, const vector<Byte>& inParams, vector<Byte>& outParams, const Context& context) { - Outgoing __out(__connection, __reference, operation, nonmutating, context); + Outgoing __out(__connection, __reference, operation, isIdempotent, context); BasicStream* __os = __out.os(); __os->writeBlob(inParams); bool ok = __out.invoke(); @@ -1192,13 +1192,13 @@ IceDelegateD::Ice::Object::ice_facets(const ::Ice::Context& __context) bool IceDelegateD::Ice::Object::ice_invoke(const string& operation, - bool nonmutating, + bool isIdempotent, const vector<Byte>& inParams, vector<Byte>& outParams, const ::Ice::Context& context) { Current current; - __initCurrent(current, operation, nonmutating, context); + __initCurrent(current, operation, isIdempotent, context); while(true) { Direct __direct(__adapter, current); @@ -1253,12 +1253,12 @@ IceDelegateD::Ice::Object::__copyFrom(const ::IceInternal::Handle< ::IceDelegate } void -IceDelegateD::Ice::Object::__initCurrent(Current& current, const string& op, bool nonmutating, const Context& context) +IceDelegateD::Ice::Object::__initCurrent(Current& current, const string& op, bool idempotent, const Context& context) { current.id = __reference->identity; current.facet = __reference->facet; current.operation = op; - current.isNonmutating = nonmutating; + current.isIdempotent = idempotent; current.ctx = context; } diff --git a/cpp/src/Ice/TraceUtil.cpp b/cpp/src/Ice/TraceUtil.cpp index e0675cf585a..884e88b87d6 100644 --- a/cpp/src/Ice/TraceUtil.cpp +++ b/cpp/src/Ice/TraceUtil.cpp @@ -111,9 +111,9 @@ printRequestHeader(ostream& s, BasicStream& stream) string operation; stream.read(operation); s << "\noperation = " << operation; - bool nonmutating; - stream.read(nonmutating); - s << "\nnonmutating = " << (nonmutating ? "true" : "false"); + bool idempotent; + stream.read(idempotent); + s << "\nidempotent = " << (idempotent ? "true" : "false"); Int sz; stream.readSize(sz); s << "\ncontext = "; diff --git a/cpp/src/IceStorm/IceStormInternal.ice b/cpp/src/IceStorm/IceStormInternal.ice index a8a09d00c61..8db7889c4d2 100644 --- a/cpp/src/IceStorm/IceStormInternal.ice +++ b/cpp/src/IceStorm/IceStormInternal.ice @@ -46,8 +46,8 @@ interface TopicLink * * @param op The operation name. * - * @param nonmutating Flag indicating whether the operation is - * nonmutating. + * @param isIdempotent Flag indicating whether the operation is + * idempotent. * * @param data The encoded for the operation in parameters. * @@ -55,7 +55,7 @@ interface TopicLink * originating request. * **/ - void forward(string op, bool \nonmutating, ByteSeq data, ContextData context); + void forward(string op, bool isIdempotent, ByteSeq data, ContextData context); }; /** @@ -74,7 +74,7 @@ interface TopicInternal extends Topic * @return The TopicLink for the Topic. * **/ - TopicLink* getLinkProxy(); + idempotent TopicLink* getLinkProxy(); }; }; // End module IceStorm diff --git a/cpp/src/IceStorm/LinkSubscriber.cpp b/cpp/src/IceStorm/LinkSubscriber.cpp index 60d46803e4b..097ec8a0be0 100644 --- a/cpp/src/IceStorm/LinkSubscriber.cpp +++ b/cpp/src/IceStorm/LinkSubscriber.cpp @@ -77,7 +77,7 @@ LinkSubscriber::publish(const Event& event) try { - _obj->forward(event.op, event.nonmutating, event.data, event.context); + _obj->forward(event.op, event.isIdempotent, event.data, event.context); } catch(const Ice::ObjectNotExistException& e) { diff --git a/cpp/src/IceStorm/OnewaySubscriber.cpp b/cpp/src/IceStorm/OnewaySubscriber.cpp index 935e8964a10..30553b9b275 100644 --- a/cpp/src/IceStorm/OnewaySubscriber.cpp +++ b/cpp/src/IceStorm/OnewaySubscriber.cpp @@ -63,7 +63,7 @@ OnewaySubscriber::publish(const Event& event) try { std::vector< ::Ice::Byte> dummy; - _obj->ice_invoke(event.op, event.nonmutating, event.data, dummy, event.context); + _obj->ice_invoke(event.op, event.isIdempotent, event.data, dummy, event.context); } catch(const Ice::LocalException& e) { diff --git a/cpp/src/IceStorm/Subscriber.h b/cpp/src/IceStorm/Subscriber.h index f014bf708cd..912856f19cc 100644 --- a/cpp/src/IceStorm/Subscriber.h +++ b/cpp/src/IceStorm/Subscriber.h @@ -38,7 +38,7 @@ struct Event bool forwarded; int cost; std::string op; - bool nonmutating; + bool isIdempotent; std::vector< Ice::Byte> data; Ice::Context context; }; diff --git a/cpp/src/IceStorm/TopicI.cpp b/cpp/src/IceStorm/TopicI.cpp index ea568ddcd48..b5093bcaa80 100644 --- a/cpp/src/IceStorm/TopicI.cpp +++ b/cpp/src/IceStorm/TopicI.cpp @@ -294,7 +294,7 @@ PublisherProxyI::ice_invoke(const vector< Ice::Byte>& inParams, vector< Ice::Byt event.cost = 0; // TODO: Default comes from property? } event.op = current.operation; - event.nonmutating = current.isNonmutating; + event.isIdempotent = current.isIdempotent; event.data = inParams; event.context = context; @@ -307,14 +307,14 @@ PublisherProxyI::ice_invoke(const vector< Ice::Byte>& inParams, vector< Ice::Byt // Incoming events from linked topics. // void -TopicLinkI::forward(const string& op, bool nonmutating, const ByteSeq& data, const ContextData& context, +TopicLinkI::forward(const string& op, bool isIdempotent, const ByteSeq& data, const ContextData& context, const Ice::Current& current) { Event event; event.forwarded = true; event.cost = 0; event.op = op; - event.nonmutating = nonmutating; + event.isIdempotent = isIdempotent; event.data = data; event.context = context; diff --git a/cpp/src/Slice/Grammar.y b/cpp/src/Slice/Grammar.y index 49774b2ef9d..8af10b07d33 100644 --- a/cpp/src/Slice/Grammar.y +++ b/cpp/src/Slice/Grammar.y @@ -65,6 +65,7 @@ yyerror(const char* s) %token ICE_FALSE %token ICE_TRUE %token ICE_NONMUTATING +%token ICE_IDEMPOTENT // // Other tokens. @@ -620,7 +621,7 @@ operation_preamble string name = StringTokPtr::dynamicCast($2)->v; ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); assert(cl); - OperationPtr op = cl->createOperation(name, returnType, false); + OperationPtr op = cl->createOperation(name, returnType); cl->checkIntroduced(name, op); unit->pushContainer(op); $$ = op; @@ -631,7 +632,18 @@ operation_preamble string name = StringTokPtr::dynamicCast($3)->v; ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); assert(cl); - OperationPtr op = cl->createOperation(name, returnType, true); + OperationPtr op = cl->createOperation(name, returnType, Operation::Nonmutating); + cl->checkIntroduced(name, op); + unit->pushContainer(op); + $$ = op; +} +| ICE_IDEMPOTENT return_type ICE_IDENT_OP +{ + TypePtr returnType = TypePtr::dynamicCast($2); + string name = StringTokPtr::dynamicCast($3)->v; + ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); + assert(cl); + OperationPtr op = cl->createOperation(name, returnType, Operation::Idempotent); cl->checkIntroduced(name, op); unit->pushContainer(op); $$ = op; @@ -642,7 +654,7 @@ operation_preamble string name = StringTokPtr::dynamicCast($2)->v; ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); assert(cl); - OperationPtr op = cl->createOperation(name, returnType, false); + OperationPtr op = cl->createOperation(name, returnType); unit->pushContainer(op); unit->error("keyword `" + name + "' cannot be used as operation name"); $$ = op; @@ -653,7 +665,18 @@ operation_preamble string name = StringTokPtr::dynamicCast($3)->v; ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); assert(cl); - OperationPtr op = cl->createOperation(name, returnType, true); + OperationPtr op = cl->createOperation(name, returnType, Operation::Nonmutating); + unit->pushContainer(op); + unit->error("keyword `" + name + "' cannot be used as operation name"); + $$ = op; +} +| ICE_IDEMPOTENT return_type ICE_KEYWORD_OP +{ + TypePtr returnType = TypePtr::dynamicCast($2); + string name = StringTokPtr::dynamicCast($3)->v; + ClassDefPtr cl = ClassDefPtr::dynamicCast(unit->currentContainer()); + assert(cl); + OperationPtr op = cl->createOperation(name, returnType, Operation::Idempotent); unit->pushContainer(op); unit->error("keyword `" + name + "' cannot be used as operation name"); $$ = op; @@ -1518,6 +1541,9 @@ keyword | ICE_NONMUTATING { } +| ICE_IDEMPOTENT +{ +} ; %% diff --git a/cpp/src/Slice/Parser.cpp b/cpp/src/Slice/Parser.cpp index dec77656af9..6b10564c574 100644 --- a/cpp/src/Slice/Parser.cpp +++ b/cpp/src/Slice/Parser.cpp @@ -1764,7 +1764,7 @@ Slice::ClassDef::destroy() OperationPtr Slice::ClassDef::createOperation(const string& name, const TypePtr& returnType, - bool nonmutating) + Operation::Mode mode) { checkPrefix(name); @@ -1865,7 +1865,7 @@ Slice::ClassDef::createOperation(const string& name, _unit->error(msg); } - OperationPtr op = new Operation(this, name, returnType, nonmutating); + OperationPtr op = new Operation(this, name, returnType, mode); _contents.push_back(op); return op; } @@ -3158,10 +3158,22 @@ Slice::Operation::throws() const return _throws; } +Operation::Mode +Slice::Operation::mode() const +{ + return _mode; +} + bool Slice::Operation::nonmutating() const { - return _nonmutating; + return _mode == Nonmutating; +} + +bool +Slice::Operation::idempotent() const +{ + return _mode == Nonmutating || _mode == Idempotent; } void @@ -3272,12 +3284,12 @@ Slice::Operation::visit(ParserVisitor* visitor) Slice::Operation::Operation(const ContainerPtr& container, const string& name, const TypePtr& returnType, - bool nonmutating) : + Mode mode) : Contained(container, name), Container(container->unit()), SyntaxTreeBase(container->unit()), _returnType(returnType), - _nonmutating(nonmutating) + _mode(mode) { } diff --git a/cpp/src/Slice/Scanner.l b/cpp/src/Slice/Scanner.l index 2e0074b6271..ee7d126c312 100644 --- a/cpp/src/Slice/Scanner.l +++ b/cpp/src/Slice/Scanner.l @@ -387,6 +387,7 @@ initScanner() keywordMap["false"] = ICE_FALSE; keywordMap["true"] = ICE_TRUE; keywordMap["nonmutating"] = ICE_NONMUTATING; + keywordMap["idempotent"] = ICE_IDEMPOTENT; } // diff --git a/cpp/src/slice2cpp/Gen.cpp b/cpp/src/slice2cpp/Gen.cpp index 53894d74b0c..9d3e232a34b 100644 --- a/cpp/src/slice2cpp/Gen.cpp +++ b/cpp/src/slice2cpp/Gen.cpp @@ -1276,7 +1276,7 @@ Slice::Gen::ProxyVisitor::visitOperation(const OperationPtr& p) C << eb; C << nl << "catch(const ::IceInternal::NonRepeatable& __ex)"; C << sb; - if(p->nonmutating()) + if(p->idempotent()) { C << nl << "__handleException(*__ex.get(), __cnt);"; } @@ -1547,7 +1547,7 @@ Slice::Gen::DelegateMVisitor::visitOperation(const OperationPtr& p) C << sb; C << nl << "static const ::std::string __operation(\"" << p->name() << "\");"; C << nl << "::IceInternal::Outgoing __out(__connection, __reference, __operation, " - << (p->nonmutating() ? "true" : "false") << ", __context);"; + << (p->idempotent() ? "true" : "false") << ", __context);"; if(ret || !outParams.empty() || !throws.empty()) { C << nl << "::IceInternal::BasicStream* __is = __out.is();"; @@ -1732,7 +1732,7 @@ Slice::Gen::DelegateDVisitor::visitOperation(const OperationPtr& p) C << sp << nl << retS << nl << "IceDelegateD" << scoped << paramsDecl; C << sb; C << nl << "::Ice::Current __current;"; - C << nl << "__initCurrent(__current, \"" << p->name() << "\", " << (p->nonmutating() ? "true" : "false") + C << nl << "__initCurrent(__current, \"" << p->name() << "\", " << (p->idempotent() ? "true" : "false") << ", __context);"; C << nl << "while(true)"; C << sb; diff --git a/cpp/src/slice2java/Gen.cpp b/cpp/src/slice2java/Gen.cpp index b8408efe757..b84e18029a8 100644 --- a/cpp/src/slice2java/Gen.cpp +++ b/cpp/src/slice2java/Gen.cpp @@ -2067,7 +2067,7 @@ Slice::Gen::HelperVisitor::visitClassDefStart(const ClassDefPtr& p) out << eb; out << nl << "catch(IceInternal.NonRepeatable __ex)"; out << sb; - if(op->nonmutating()) + if(op->idempotent()) { out << nl << "__cnt = __handleException(__ex.get(), __cnt);"; } @@ -3005,7 +3005,7 @@ Slice::Gen::DelegateMVisitor::visitClassDefStart(const ClassDefPtr& p) out << sb; list<string> metaData = op->getMetaData(); out << nl << "IceInternal.Outgoing __out = getOutgoing(\"" << op->name() << "\", " - << (op->nonmutating() ? "true" : "false") << ", __context);"; + << (op->idempotent() ? "true" : "false") << ", __context);"; out << nl << "try"; out << sb; if(!inParams.empty()) @@ -3170,7 +3170,7 @@ Slice::Gen::DelegateDVisitor::visitClassDefStart(const ClassDefPtr& p) out << sb; list<string> metaData = op->getMetaData(); out << nl << "Ice.Current __current = new Ice.Current();"; - out << nl << "__initCurrent(__current, \"" << op->name() << "\", " << (op->nonmutating() ? "true" : "false") + out << nl << "__initCurrent(__current, \"" << op->name() << "\", " << (op->idempotent() ? "true" : "false") << ", __context);"; out << nl << "while(true)"; out << sb; |