diff --git a/.gitignore b/.gitignore index c284e43..2f6c052 100644 --- a/.gitignore +++ b/.gitignore @@ -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 diff --git a/README.md b/README.md index 6641c74..04883a3 100644 --- a/README.md +++ b/README.md @@ -1,2 +1,2 @@ -# ess-server -Encrypted Storage Service +# vss-server +Versioned Storage Service diff --git a/build.gradle b/app/build.gradle similarity index 56% rename from build.gradle rename to app/build.gradle index 36dbc58..83102a3 100644 --- a/build.gradle +++ b/app/build.gradle @@ -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' } @@ -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" diff --git a/src/main/proto/ess.proto b/app/src/main/proto/vss.proto similarity index 75% rename from src/main/proto/ess.proto rename to app/src/main/proto/vss.proto index 1184887..8a013b2 100644 --- a/src/main/proto/ess.proto +++ b/app/src/main/proto/vss.proto @@ -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 { /* @@ -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 { @@ -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; diff --git a/settings.gradle b/settings.gradle index 2dfe4e3..9c6e2fb 100644 --- a/settings.gradle +++ b/settings.gradle @@ -1,2 +1,2 @@ -rootProject.name = 'ess-server' - +rootProject.name = 'vss-server' +include 'app'