Comments (5)
Consider the following requirements:
- Save data associated with Content-Server PUT
- Data can be retrieved by client using Station ID
- Data expires after 30s of inactivity or if not the last 20 most recent updates
- Data can be backedup and restored if needed
from java_server.
Design:
Map<String, Map<String, Map<String, String>>> archive: file system storage (in memory)
Map[ContentServerID] = Map<FileName, Map<FieldName, String>
- If PUT request for the same file -> overwrite previous file.
- Fields:
- Updated: whether an update to the main database using this data has completed succesfully
- Deleted: boolean flag on whether the data should be removed
- Content: body of a PUT request.
Map<String, String> database. Where the key is station ID and value is content
PriorityBlockingQueue taskQueue - task queue
LinkedList updateList -> list of updates
from java_server.
ExecutorService connRevPool = Executors.newCachedThreadPool();
Connection receive threadpool:
- Retrieve request message -> Update TimeStamp
- Classify - GET/PUT
- Handle GET:
- if empty -> Return empty body, do not submite to taskQueue
- otherwise -> Submit to task Queue
- Handle PUT: submit to task Queue
- Get future from taskQueue submission.
- Poll the future and send the result back to client
from java_server.
ThreadPoolExecutor executorPool = new .... // Only single thread executor. Use Priority queue
from java_server.
ScheduledExecutionService schedPool ... //Executed the following:
- Run backup
- Delete outdated files
from java_server.
Related Issues (20)
- Add tests on Github Action
- Add a Json Parser
- Json Handle Same ID
- Aggregation Server implementation HOT 1
- Add Lamport Clock
- Add Lamport Clock tests
- Add GETClient Retry and Timeout
- Test Retry and Timeout
- Design a simple ContentServer
- AggregationServer handles ContentServer
- Add documentations for all methods written
- Implements Task Queue
- Add test for cleaning up data after 30s or if too stale HOT 1
- Add/Test Backup Runnable
- Add HeartBeat/LeaderDelegation Algorithm
- Add Server and Client Logging
- Add test for composite data
- Add GitHub Code Coverage/Badge HOT 1
- Allows interoperability
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 java_server.