Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
H
hpdos
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Analytics
Analytics
CI / CD
Repository
Value Stream
Wiki
Wiki
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
SYNERG
hpdos
Commits
b535b3ce
Commit
b535b3ce
authored
Apr 06, 2021
by
NILANJAN DAW
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Added random read from replicaset
parent
a5d9a657
Changes
7
Expand all
Hide whitespace changes
Inline
Side-by-side
Showing
7 changed files
with
150 additions
and
59 deletions
+150
-59
code/hpdos_client/app.config
code/hpdos_client/app.config
+1
-1
code/hpdos_client/app/src/main/java/HpdosClient/ClientRunner.java
...os_client/app/src/main/java/HpdosClient/ClientRunner.java
+89
-57
code/hpdos_client/app/src/main/proto/PacketFormat.proto
code/hpdos_client/app/src/main/proto/PacketFormat.proto
+16
-0
code/hpdos_server/app/src/main/java/hpdos/handler/NetworkHandler.java
...erver/app/src/main/java/hpdos/handler/NetworkHandler.java
+20
-0
code/hpdos_server/app/src/main/java/hpdos/lib/InlineReplicationService.java
...app/src/main/java/hpdos/lib/InlineReplicationService.java
+6
-1
code/hpdos_server/app/src/main/java/hpdos/lib/ReplicationService.java
...erver/app/src/main/java/hpdos/lib/ReplicationService.java
+2
-0
code/hpdos_server/app/src/main/proto/PacketFormat.proto
code/hpdos_server/app/src/main/proto/PacketFormat.proto
+16
-0
No files found.
code/hpdos_client/app.config
View file @
b535b3ce
app
.
name
=
"HPDOS-Client"
app
.
version
=
"0.1.4"
app
.
thread_count
=
12
app
.
runtime
=
15
app
.
runtime
=
30
app
.
cycle_create
=
1
app
.
cycle_read
=
4
app
.
cycle_update
=
3
...
...
code/hpdos_client/app/src/main/java/HpdosClient/ClientRunner.java
View file @
b535b3ce
This diff is collapsed.
Click to expand it.
code/hpdos_client/app/src/main/proto/PacketFormat.proto
View file @
b535b3ce
...
...
@@ -14,6 +14,7 @@ service NetworkService {
rpc
createMetadata
(
Packet
)
returns
(
Packet
)
{}
rpc
updateMetadata
(
Packet
)
returns
(
Packet
)
{}
rpc
deleteMetadata
(
Packet
)
returns
(
Packet
)
{}
rpc
getReadReplicaList
(
RequestList
)
returns
(
ResponseList
)
{}
}
...
...
@@ -53,4 +54,19 @@ message Ack {
message
Nack
{
string
key
=
2
;
int32
version
=
3
;
}
message
RequestList
{}
message
ResponseList
{
int32
operationType
=
1
;
int32
status
=
2
;
repeated
Follower
follower
=
3
;
}
message
Follower
{
string
ip
=
1
;
int32
port
=
2
;
string
followerID
=
3
;
int64
lastSeen
=
4
;
}
\ No newline at end of file
code/hpdos_server/app/src/main/java/hpdos/handler/NetworkHandler.java
View file @
b535b3ce
...
...
@@ -2,12 +2,14 @@ package hpdos.handler;
import
com.google.common.base.Stopwatch
;
import
hpdos.grpc.*
;
import
hpdos.lib.MasterFollower
;
import
hpdos.lib.ReplicationService
;
import
hpdos.message.RequestBuilder
;
import
hpdos.message.ResponseBuilder
;
import
io.grpc.stub.StreamObserver
;
import
java.util.ArrayList
;
import
java.util.HashMap
;
import
java.util.concurrent.ExecutionException
;
public
class
NetworkHandler
extends
NetworkServiceGrpc
.
NetworkServiceImplBase
{
...
...
@@ -75,6 +77,24 @@ public class NetworkHandler extends NetworkServiceGrpc.NetworkServiceImplBase {
responseObserver
.
onCompleted
();
}
@Override
public
void
getReadReplicaList
(
RequestList
requestList
,
StreamObserver
<
ResponseList
>
responseListStreamObserver
)
{
HashMap
<
String
,
MasterFollower
>
followers
=
replicationService
.
getFollowers
();
ResponseList
.
Builder
responseList
=
ResponseList
.
newBuilder
();
for
(
MasterFollower
follower:
followers
.
values
())
{
Follower
.
Builder
replica
=
Follower
.
newBuilder
();
replica
.
setIp
(
follower
.
getIp
());
replica
.
setPort
(
follower
.
getPort
());
replica
.
setFollowerID
(
follower
.
getFollowerID
());
replica
.
setLastSeen
(
follower
.
getLastSeen
());
replica
.
build
();
responseList
.
addFollower
(
replica
);
}
responseListStreamObserver
.
onNext
(
responseList
.
build
());
responseListStreamObserver
.
onCompleted
();
}
private
Packet
replicate
(
Packet
requestPacket
)
{
ReplicationRequest
replicationRequest
=
RequestBuilder
.
buildReplicationRequest
(
new
ArrayList
<>(
requestPacket
.
getRequestList
()));
...
...
code/hpdos_server/app/src/main/java/hpdos/lib/InlineReplicationService.java
View file @
b535b3ce
...
...
@@ -104,6 +104,11 @@ public class InlineReplicationService implements ReplicationService {
ListenableFuture
<
ReplicationResponse
>
res
=
stub
.
replicateMetadata
(
replicationRequest
);
}
return
null
;
throw
new
UnsupportedOperationException
(
"Implementation not complete"
);
}
@Override
public
HashMap
<
String
,
MasterFollower
>
getFollowers
()
{
return
followers
;
}
}
code/hpdos_server/app/src/main/java/hpdos/lib/ReplicationService.java
View file @
b535b3ce
...
...
@@ -3,10 +3,12 @@ package hpdos.lib;
import
hpdos.grpc.ReplicationRequest
;
import
hpdos.grpc.ReplicationResponse
;
import
java.util.HashMap
;
import
java.util.concurrent.ExecutionException
;
public
interface
ReplicationService
{
abstract
ReplicationResponse
replicateMetadata
(
ReplicationRequest
replicationRequest
)
throws
InterruptedException
,
ExecutionException
;
abstract
ReplicationResponse
replicateMetadataAsync
(
ReplicationRequest
replicationRequest
);
abstract
void
cleanup
()
throws
InterruptedException
;
abstract
HashMap
<
String
,
MasterFollower
>
getFollowers
();
}
code/hpdos_server/app/src/main/proto/PacketFormat.proto
View file @
b535b3ce
...
...
@@ -14,6 +14,7 @@ service NetworkService {
rpc
createMetadata
(
Packet
)
returns
(
Packet
)
{}
rpc
updateMetadata
(
Packet
)
returns
(
Packet
)
{}
rpc
deleteMetadata
(
Packet
)
returns
(
Packet
)
{}
rpc
getReadReplicaList
(
RequestList
)
returns
(
ResponseList
)
{}
}
...
...
@@ -53,4 +54,19 @@ message Ack {
message
Nack
{
string
key
=
2
;
int32
version
=
3
;
}
message
RequestList
{}
message
ResponseList
{
int32
operationType
=
1
;
int32
status
=
2
;
repeated
Follower
follower
=
3
;
}
message
Follower
{
string
ip
=
1
;
int32
port
=
2
;
string
followerID
=
3
;
int64
lastSeen
=
4
;
}
\ No newline at end of file
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment