Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Submit feedback
Sign in
Toggle navigation
K
key_value-server
Project
Project
Details
Activity
Releases
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
amir.yosef
key_value-server
Commits
e58fd43b
Commit
e58fd43b
authored
Aug 13, 2024
by
amir.yosef
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
cleaning
parent
0a1f7bde
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
0 additions
and
93 deletions
+0
-93
PingCommand.java
src/handshake/PingCommand.java
+0
-22
ReplConfCommand.java
src/handshake/ReplConfCommand.java
+0
-54
Sender.java
src/handshake/Sender.java
+0
-17
No files found.
src/handshake/PingCommand.java
deleted
100644 → 0
View file @
0a1f7bde
package
handshake
;
import
model.Command
;
import
parser.CommandParser
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.List
;
public
class
PingCommand
extends
Sender
{
public
PingCommand
(
CommandParser
commandParser
)
{
super
(
commandParser
);
}
@Override
public
void
send
(
BufferedReader
bufferedReader
,
OutputStream
outputStream
)
throws
IOException
{
byte
[]
bytes
=
commandParser
.
getResponseFromCommandArray
(
List
.
of
(
Command
.
PING
.
getValue
().
toLowerCase
())).
getBytes
();
outputStream
.
write
(
bytes
);
outputStream
.
flush
();
}
}
src/handshake/ReplConfCommand.java
deleted
100644 → 0
View file @
0a1f7bde
package
handshake
;
import
model.Command
;
import
parser.CommandParser
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.OutputStream
;
import
java.util.List
;
public
class
ReplConfCommand
extends
Sender
{
private
final
String
port
;
public
ReplConfCommand
(
String
port
,
CommandParser
commandParser
)
{
super
(
commandParser
);
this
.
port
=
port
;
}
@Override
public
void
send
(
BufferedReader
bufferedReader
,
OutputStream
outputStream
)
throws
IOException
{
String
replconfResp
=
""
;
replconfResp
=
getReplConfResp
(
bufferedReader
,
outputStream
);
if
(!
replconfResp
.
isEmpty
())
{
replconfResp
=
sendReplConfCapa
(
bufferedReader
,
outputStream
);
}
if
(!
replconfResp
.
isEmpty
())
{
outputStream
.
write
(
commandParser
.
getResponseFromCommandArray
(
List
.
of
(
Command
.
PSYNC
.
getValue
(),
"?"
,
"-1"
)).
getBytes
());
}
}
private
String
sendReplConfCapa
(
BufferedReader
bufferedReader
,
OutputStream
outputStream
)
throws
IOException
{
outputStream
.
write
(
commandParser
.
getResponseFromCommandArray
(
List
.
of
(
Command
.
REPLCONF
.
getValue
(),
"capa"
,
"npsync2"
)
).
getBytes
()
);
outputStream
.
flush
();
return
bufferedReader
.
readLine
();
}
private
String
getReplConfResp
(
BufferedReader
bufferedReader
,
OutputStream
outputStream
)
throws
IOException
{
outputStream
.
write
(
commandParser
.
getResponseFromCommandArray
(
List
.
of
(
Command
.
REPLCONF
.
getValue
(),
"listening-port"
,
String
.
valueOf
(
port
))
).
getBytes
()
);
outputStream
.
flush
();
return
bufferedReader
.
readLine
();
}
}
src/handshake/Sender.java
deleted
100644 → 0
View file @
0a1f7bde
package
handshake
;
import
parser.CommandParser
;
import
java.io.BufferedReader
;
import
java.io.IOException
;
import
java.io.OutputStream
;
public
abstract
class
Sender
{
protected
final
CommandParser
commandParser
;
protected
Sender
(
CommandParser
commandParser
)
{
this
.
commandParser
=
commandParser
;
}
public
abstract
void
send
(
BufferedReader
bufferedReader
,
OutputStream
outputStream
)
throws
IOException
;
}
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