Skip to content

Commit

Permalink
Remove GrpcService, define REST api based objects
Browse files Browse the repository at this point in the history
  • Loading branch information
G8XSU committed Nov 19, 2022
1 parent 2e3fec2 commit e42fa52
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 38 deletions.
13 changes: 10 additions & 3 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,9 +1,16 @@
.protoc-version
.idea/*
build/*
*.ipr
*.iws
.settings/*
.project
.gradle/*
gradle/*
gradlew*
*.ipr
*.iws
build/*
app/build/*
app/bin/*
app/.classpath
app/.project
app/.settings

4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
# ess-server
Encrypted Storage Service
# vss-server
Versioned Storage Service
21 changes: 6 additions & 15 deletions build.gradle → app/build.gradle
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
buildscript {
ext.gradleVersion = '7.5.1'
ext.protobufPlugInVersion = '0.8.12'
ext.protobufVersion = '3.21.6'
ext.grpcVersion = '1.49.1'

ext.junitVersion = '5.8.1'
ext.protobufVersion = '3.21.7'
ext.jerseyVersion = '3.1.0'
ext.junitVersion = '5.9.0'
}

plugins {
id 'java'
id 'com.google.protobuf' version "${protobufPlugInVersion}"
id 'war'
id 'idea'
}

Expand All @@ -23,21 +23,12 @@ idea {
}
}

group 'org.ess'
version '1.0-SNAPSHOT'
group 'org.vss'
version '1.0'

wrapper {
gradleVersion = "$gradleVersion"
}

dependencies {
// grpc and protobuf
implementation "com.google.protobuf:protobuf-java:$protobufVersion"
implementation "io.grpc:grpc-protobuf:$grpcVersion"
implementation "io.grpc:grpc-stub:$grpcVersion"
implementation "io.grpc:grpc-netty-shaded:$grpcVersion"
implementation "org.apache.tomcat:annotations-api:6.0.53" //Required for Java9+


testImplementation "org.junit.jupiter:junit-jupiter-api:$junitVersion"
testRuntimeOnly "org.junit.jupiter:junit-jupiter-engine:$junitVersion"
Expand Down
30 changes: 14 additions & 16 deletions src/main/proto/ess.proto → app/src/main/proto/vss.proto
Original file line number Diff line number Diff line change
@@ -1,12 +1,6 @@
syntax = "proto3";
option java_multiple_files = true;
package org.ess;

service EncryptedStorageService {
rpc get(GetObjectRequest) returns (GetObjectResponse);
rpc put(PutObjectRequest) returns (PutObjectResponse);
//TODO: Add getKeysSummary (Gives version numbers for all keys in a store) and list by prefix APIs
}
package org.vss;

message GetObjectRequest {
/*
Expand All @@ -19,11 +13,7 @@ message GetObjectRequest {
string key = 2;
}
message GetObjectResponse {
bool success = 1;
KeyValue value = 2;

// Optional, only present when success = false
optional ErrorResponse errorResponse = 3;
}

message PutObjectRequest {
Expand Down Expand Up @@ -55,24 +45,32 @@ message PutObjectRequest {
}

message PutObjectResponse {
bool success = 1;
optional ErrorResponse errorResponse = 2;
}

/*
When HttpStatusCode is not ok(200), response `content` contains serialized ErrorResponse.
*/
message ErrorResponse{
ErrorCode errorCode = 1;
string message = 2;
}
/*
ErrorCodes along with corresponding HttpStatusCodes used in response
*/
enum ErrorCode{
Unknown = 0;
ConflictException = 2;
InvalidRequestException = 3;
InternalServerException = 4;
ConflictException = 409;
InvalidRequestException = 400;
InternalServerException = 500;
}

message KeyValue {
string key = 1;

/*
For first write of store, version should be '0'. If write succeeds, clients must increment
their corresponding key version(on device) by 1.
*/
int64 version = 2;

bytes value = 3;
Expand Down
4 changes: 2 additions & 2 deletions settings.gradle
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
rootProject.name = 'ess-server'

rootProject.name = 'vss-server'
include 'app'

0 comments on commit e42fa52

Please sign in to comment.