Commit 093cf4a1 authored by Mo Firouz's avatar Mo Firouz Committed by Andrei Mihu
Browse files

Add storage. (#169)

parent 97ac0c55
Loading
Loading
Loading
Loading
+30 −1
Original line number Diff line number Diff line
# This file is autogenerated, do not edit; changes may be undone by the next 'dep ensure'.


[[projects]]
  name = "github.com/davecgh/go-spew"
  packages = ["spew"]
  revision = "346938d642f2ec3594ed81d874461961cd0faa76"
  version = "v1.1.0"

[[projects]]
  name = "github.com/dgrijalva/jwt-go"
  packages = ["."]
@@ -87,6 +93,12 @@
  revision = "645ef00459ed84a119197bfb8d8205042c6df63d"
  version = "v0.8.0"

[[projects]]
  name = "github.com/pmezard/go-difflib"
  packages = ["difflib"]
  revision = "792786c7400a136282c1664665ae0a8db921c6c2"
  version = "v1.0.0"

[[projects]]
  name = "github.com/rubenv/sql-migrate"
  packages = [
@@ -100,6 +112,23 @@
  packages = ["."]
  revision = "063359185d32c6b045fa171ad7033ea545864fa1"

[[projects]]
  name = "github.com/stretchr/objx"
  packages = ["."]
  revision = "facf9a85c22f48d2f52f2380e4efce1768749a89"
  version = "v0.1"

[[projects]]
  name = "github.com/stretchr/testify"
  packages = [
    ".",
    "assert",
    "http",
    "mock"
  ]
  revision = "69483b4bd14f5845b5a1e55bca19e954e827f1d0"
  version = "v1.1.4"

[[projects]]
  name = "github.com/yuin/gopher-lua"
  packages = [
@@ -241,6 +270,6 @@
[solve-meta]
  analyzer-name = "dep"
  analyzer-version = 1
  inputs-digest = "5d773d2802af4225a763597cd5656ef5fa212adb45f7e4cf3e46b3bc134947b7"
  inputs-digest = "252246cd77180cbf3e076b45d44f72cc66d42f3c076c247e3fe6e5c32c5107f1"
  solver-name = "gps-cdcl"
  solver-version = 1
+4 −0
Original line number Diff line number Diff line
@@ -57,3 +57,7 @@
[[constraint]]
  name = "github.com/gobuffalo/packr"
  revision = "6434a292ac52e6964adebfdce3f9ce6d9f16be01"

[[constraint]]
  name = "github.com/stretchr/testify"
  version = "~1.1.4"
+227 −285

File changed.

Preview size limit exceeded, changes collapsed.

+6 −8
Original line number Diff line number Diff line
@@ -273,17 +273,15 @@ func request_Nakama_DeleteNotifications_0(ctx context.Context, marshaler runtime

}

var (
	filter_Nakama_DeleteStorageObjects_0 = &utilities.DoubleArray{Encoding: map[string]int{}, Base: []int(nil), Check: []int(nil)}
)

func request_Nakama_DeleteStorageObjects_0(ctx context.Context, marshaler runtime.Marshaler, client NakamaClient, req *http.Request, pathParams map[string]string) (proto.Message, runtime.ServerMetadata, error) {
	var protoReq DeleteStorageObjectsRequest
	var metadata runtime.ServerMetadata

	if err := runtime.PopulateQueryParameters(&protoReq, req.URL.Query(), filter_Nakama_DeleteStorageObjects_0); err != nil {
	if req.ContentLength > 0 {
		if err := marshaler.NewDecoder(req.Body).Decode(&protoReq); err != nil {
			return nil, metadata, status.Errorf(codes.InvalidArgument, "%v", err)
		}
	}

	msg, err := client.DeleteStorageObjects(ctx, &protoReq, grpc.Header(&metadata.HeaderMD), grpc.Trailer(&metadata.TrailerMD))
	return msg, metadata, err
@@ -1197,7 +1195,7 @@ func RegisterNakamaHandlerClient(ctx context.Context, mux *runtime.ServeMux, cli

	})

	mux.Handle("DELETE", pattern_Nakama_DeleteStorageObjects_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
	mux.Handle("PUT", pattern_Nakama_DeleteStorageObjects_0, func(w http.ResponseWriter, req *http.Request, pathParams map[string]string) {
		ctx, cancel := context.WithCancel(req.Context())
		defer cancel()
		if cn, ok := w.(http.CloseNotifier); ok {
@@ -2066,7 +2064,7 @@ var (

	pattern_Nakama_DeleteNotifications_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "notification"}, ""))

	pattern_Nakama_DeleteStorageObjects_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "storage"}, ""))
	pattern_Nakama_DeleteStorageObjects_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1, 2, 2}, []string{"v2", "storage", "delete"}, ""))

	pattern_Nakama_GetAccount_0 = runtime.MustPattern(runtime.NewPattern(1, []int{2, 0, 2, 1}, []string{"v2", "account"}, ""))

+12 −29
Original line number Diff line number Diff line
@@ -173,7 +173,10 @@ service Nakama {

  // Delete one or more objects by ID or username.
  rpc DeleteStorageObjects (DeleteStorageObjectsRequest) returns (google.protobuf.Empty) {
    option (google.api.http).delete = "/v2/storage";
    option (google.api.http) = {
      put: "/v2/storage/delete",
      body: "*"
    };
  }

  // Fetch the current user's account.
@@ -270,7 +273,7 @@ service Nakama {
    option (google.api.http).get = "/v2/notification";
  }

  // List collections of storage objects.
  // List publicly readable storage objects in a given collection.
  rpc ListStorageObjects (ListStorageObjectsRequest) returns (StorageObjectList) {
    option (google.api.http) = {
      get: "/v2/storage/{collection}",
@@ -601,7 +604,7 @@ message DeleteStorageObjectId {
// Batch delete storage objects.
message DeleteStorageObjectsRequest {
  // Batch of storage objects.
  repeated DeleteStorageObjectId objectIds = 1;
  repeated DeleteStorageObjectId object_ids = 1;
}

// A friend of a user.
@@ -711,7 +714,7 @@ message ListNotificationsRequest {
  string cacheable_cursor = 2; // value from NotificationList.cacheable_cursor.
}

// List storage objects by user ID or collection or both.
// List publicly readable storage objects in a given collection.
message ListStorageObjectsRequest {
  // ID of the user.
  string user_id = 1;
@@ -780,7 +783,7 @@ message ReadStorageObjectId {
// Batch get storage objects.
message ReadStorageObjectsRequest {
  // Batch of storage objects.
  repeated ReadStorageObjectId objectIds = 1;
  repeated ReadStorageObjectId object_ids = 1;
}

// Execute an Lua function on the server.
@@ -803,28 +806,6 @@ message Session {
  string udp_token = 3; // TODO(zyro): will we remove it?
}

// The read access permissions for a storage object.
enum StoragePermissionRead {
  // Default case. Assumed as OWNER_READ permission.
  STORAGE_PERMISSION_READ_UNSPECIFIED = 0;
  // The object does not have client read permissions.
  NO_READ = 1;
  // The object may be read by the user owner.
  OWNER_READ = 2;
  // The object may be read by any user.
  PUBLIC_READ = 3;
}

// The write access permission for a storage object.
enum StoragePermissionWrite {
  // Default case. Assumed as OWNER_WRITE permission.
  STORAGE_PERMISSION_WRITE_UNSPECIFIED = 0;
  // The object does not have client write permissions.
  NO_WRITE = 1;
  // The object may be written by the user owner.
  OWNER_WRITE = 2;
}

// An object within the storage engine.
message StorageObject {
  // The collection which stores the object.
@@ -855,6 +836,8 @@ message StorageObjectAck {
  string key = 2;
  // The version hash of the object.
  string version = 3;
  // The owner of the object.
  string user_id = 4;
}

// Batch of acknowledgements for the storage object write.
@@ -946,9 +929,9 @@ message WriteStorageObject {
  // The version hash of the object to check. Possible values are: ["", "*", "#hash#"].
  string version = 4; // if-match and if-none-match
  // The read access permissions for the object.
  int32 permission_read = 5;
  google.protobuf.Int32Value permission_read = 5;
  // The write access permissions for the object.
  int32 permission_write = 6;
  google.protobuf.Int32Value permission_write = 6;
}

// Write objects to the storage engine.
Loading