Comments (3)
So you are suggesting something like these additional methods?
public interface Sirius {
...
Future<SiriusResult> <T> enqueuePut(String key, byte[] body, T localData);
}
interface RequestHandler {
...
SiriusResult <T> handlePut(String key, byte[] body, T localData);
}
Possibly the <T>
parameters would want to get moved up onto the interfaces so that we could statically check that the RequestHandler
can handle the same types of localData
that were being enqueued.
from sirius.
Yes, exactly like that. I like your suggestion about pushing up the types, as one of the motivations is to give stronger static type checking between enqueue and handle than just reducing everything to Object/AnyRef as in the SiriusResult type.
from sirius.
I hacked up a prototype of this interface that build on the Sirius1Dot2 stuff. Essentially it creates new interfaces for the RequestHandler and Sirius instance that are parametrized by two types T and U, and a factory method that is parametrized similarly. The prototypes for enqueuePut and handlePut are as follows (with other interface methods being analogous):
enqueuePut(key: String, body: Array[Byte], tag: T): Future[U]
handlePut(key: String, body: Array[Byte]: tag: Option[T]): U
These are intentionally as general as possible, allowing users to pass in, say, Option as the return type (U). The handler is passed SomeT when receiving a locally-enqueued Put, and None when receiving either a remotely-enqueued Put or during recovery from the WAL. Exceptions in the handler are passed back using the standard Java Future interface, i.e., by throwing an ExecutionException in handlePut, with the thrown exception as the cause value.
The prototype includes sufficient implementation glue to make this all work transparently with the existing interfaces, and satisfy all existing unit tests. It includes the Promise-based workaround I described in Issue #6 for return values not currently being propagated correctly, but I came to the conclusion that that is not a good long-term solution and we should just fix #6.
from sirius.
Related Issues (20)
- Model leader election as simple FSM
- Stale ActorRef eviction is broken
- Followers sometimes stop following if too far out of date HOT 7
- Old deletes need to be purged during Compaction HOT 1
- Delete purging can remove necessary events from the uberstore
- nodetool requires akka.tcp protocol that SiriusShortNameParser doesn't support
- Subset of follower nodes missing data
- AskTimeoutExceptions during startup
- Support cross-building for Scala 2.12+ HOT 1
- Support HTTP for Sirius following instead of Akka remoting
- Should we have native Scala external interfaces? HOT 7
- remove deprecated akka.event-handlers property HOT 1
- Verify copyright in wiki HOT 2
- Update wiki with scala doc references HOT 1
- fix scaladoc warnings HOT 2
- make scaladoc handle linking to external javadoc or scaladoc properly HOT 2
- Slow node eventually DDOS' itself attempting to catch up with others HOT 2
- Reduce size of uberstore indices
- Use ActorSelections for remote nodes in Membership
- Use ActorSelection instead of ActorRef in Leader
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from sirius.