2020-06-06 20:43:14 +02:00
|
|
|
class FileStorage::Errors
|
|
|
|
JSONIPC.request GenericError, 200 do
|
|
|
|
property mid : String
|
|
|
|
property reason : String
|
|
|
|
def initialize(@mid, @reason)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
FileStorage.errors << GenericError
|
|
|
|
|
2020-06-07 01:23:31 +02:00
|
|
|
JSONIPC.request Authorization, 201 do
|
|
|
|
property mid : String
|
|
|
|
property reason : String
|
|
|
|
def initialize(@mid, @reason = "authorization")
|
|
|
|
end
|
|
|
|
end
|
|
|
|
FileStorage.errors << Authorization
|
|
|
|
|
2020-06-06 20:43:14 +02:00
|
|
|
# When uploading a chunk already present in the DB.
|
2020-06-07 01:23:31 +02:00
|
|
|
JSONIPC.request ChunkAlreadyUploaded, 202 do
|
2020-06-06 20:43:14 +02:00
|
|
|
property mid : String
|
|
|
|
property reason = "Chunk already present"
|
|
|
|
property filedigest : String
|
2020-06-08 20:03:17 +02:00
|
|
|
property next_chunk : Int32
|
2020-06-06 20:43:14 +02:00
|
|
|
|
2020-06-08 20:03:17 +02:00
|
|
|
def initialize(@mid, @filedigest, @next_chunk)
|
2020-06-06 20:43:14 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
FileStorage.errors << ChunkAlreadyUploaded
|
|
|
|
|
|
|
|
# You upload a chunk, but you are not the owner of the file.
|
2020-06-07 01:23:31 +02:00
|
|
|
JSONIPC.request ChunkUploadDenied, 203 do
|
2020-06-06 20:43:14 +02:00
|
|
|
property mid : String
|
|
|
|
property reason = "This file is not yours"
|
|
|
|
property filedigest : String
|
|
|
|
|
|
|
|
def initialize(@mid, @filedigest)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
FileStorage.errors << ChunkUploadDenied
|
|
|
|
|
|
|
|
# When uploading a file already present in the DB.
|
2020-06-07 01:23:31 +02:00
|
|
|
JSONIPC.request FileExists, 204 do
|
2020-06-06 20:43:14 +02:00
|
|
|
property mid : String
|
|
|
|
property reason = "file already present"
|
2020-06-14 18:11:36 +02:00
|
|
|
property path : String
|
2020-06-08 23:02:31 +02:00
|
|
|
property next_chunk : Int32
|
2020-06-06 20:43:14 +02:00
|
|
|
|
2020-06-14 18:11:36 +02:00
|
|
|
def initialize(@mid, @path, @next_chunk)
|
2020-06-06 20:43:14 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
FileStorage.errors << FileExists
|
|
|
|
|
|
|
|
# When transfering a chunk for an inexistent file.
|
2020-06-07 01:23:31 +02:00
|
|
|
JSONIPC.request FileDoesNotExist, 205 do
|
2020-06-06 20:43:14 +02:00
|
|
|
property mid : String
|
|
|
|
property reason = "file does not exist"
|
|
|
|
property filedigest : String
|
|
|
|
|
|
|
|
def initialize(@mid, @filedigest)
|
|
|
|
end
|
|
|
|
end
|
|
|
|
FileStorage.errors << FileDoesNotExist
|
2020-06-08 23:02:31 +02:00
|
|
|
|
|
|
|
# When a file was already fully uploaded.
|
|
|
|
JSONIPC.request FileFullyUploaded, 206 do
|
|
|
|
property mid : String
|
|
|
|
property reason = "file already uploaded fully"
|
2020-06-14 18:16:01 +02:00
|
|
|
property path : String
|
2020-06-08 23:02:31 +02:00
|
|
|
|
2020-06-14 18:16:01 +02:00
|
|
|
def initialize(@mid, @path)
|
2020-06-08 23:02:31 +02:00
|
|
|
end
|
|
|
|
end
|
|
|
|
FileStorage.errors << FileFullyUploaded
|
2020-06-06 20:43:14 +02:00
|
|
|
end
|