com.ursaj.hfs.message.messages.proto Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of hfs-messages Show documentation
Show all versions of hfs-messages Show documentation
HFS communication messages.
/**
* Copyright (C) 2011 Ursa Project LLC (http://ursaj.com)
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.ursaj.hfs.message;
/** Java options. */
option java_package = com.ursaj.hfs.message;
option java_multiple_files = true;
option optimize_for = LITE_RUNTIME;
/** Protostuff options. */
option primitive_numbers_if_optional = true;
option builder_pattern = true;
option generate_field_map = true;
option separate_schema = true;
option generate_helper_methods = true;
/**
* Communication message to pass over network. This message also provides support of protocol versions.
* If protocol changes (A) messages should remain compatible or (B) new message type should be introduced.
*/
message HfsMessage {
/** Note! A single and only single field should always be set. */
optional HfsGcRequest gcRequest = 1;
optional HfsGetRequest getRequest = 2;
optional HfsUploadRequest uploadRequest = 3;
optional HfsUploadInfo uploadInfo = 5;
}
/** HFS garbage collector request. */
message HfsGcRequest {
/** File ID to continue GC process from (inclusive). */
required HfsUuid fromId = 1;
}
/** HFS get request. */
message HfsGetRequest {
/** Expiration timestamp (ms). */
required int64 expiration = 1;
/** Requested file ID. */
required HfsUuid fileId = 2;
}
/** HFS upload request. */
message HfsUploadRequest {
/** Expiration timestamp (ms). */
required int64 expiration = 1;
/**
* Format of the HFS server response after upload process completes, e.g.:
* - null - to send result token in the HTTP response body;
* - URI - to send HTTP redirect with result token in the query string.
*
* For more details and options wee HFS server specification.
*/
optional string format = 2 [default = null];
/** Maximum upload size per single upload request (bytes). */
optional int64 maxUploadSize = 3 [default = 10485760]; /* 10 MB. */
/** Maximum size of single uploaded file in this request (bytes). */
optional int64 maxFileSize = 4 [default = 10485760]; /* 10 MB. */
/** Maximum count of uploaded files in the request. */
optional int32 maxFilesCount = 5 [default = 10];
}
/** Detailed information for upload operation. */
message HfsUploadInfo {
/** Upload status. */
required HfsUploadStatus status = 1;
/** Location of the file with actual upload information. It is provided only in case status.code = 301. */
optional HfsLocation location = 2;
/** Uploaded files information. It is provided only in case status.code = 200. */
repeated HfsFileInfo files = 3;
}
/** Upload operation status. */
message HfsUploadStatus {
/** Upload status code. */
required int32 code = 1;
/** Upload status message. */
required string message = 2;
}
/** Remote file location. */
message HfsLocation {
/** File ID in HFS server. */
required HfsUuid fileId = 1;
}
/** Detailed information for uploaded file. */
message HfsFileInfo {
/** Uploaded file ID stored on in HFS. */
required HfsUuid fileId = 1;
/** FIle name from user's upload information, otherwise - {@code null}. */
optional string fileName = 2;
/** File content type. */
required string contentType = 3;
/** File size. */
required int64 size = 4;
/** Date this file will be checked for cleanup (remove) by HFS. */
required int64 validation = 5;
}
/** HFS UUID wrapper. */
message HfsUuid {
required int64 mostSigBits = 1;
required int64 leastSigBits = 2;
}