Page Menu
Home
DevCentral
Search
Configure Global Search
Log In
Files
F3753797
D2429.id6108.diff
No One
Temporary
Actions
View File
Edit File
Delete File
View Transforms
Subscribe
Mute Notifications
Award Token
Flag For Later
Size
3 KB
Referenced Files
None
Subscribers
None
D2429.id6108.diff
View Options
diff --git a/Cargo.toml b/Cargo.toml
--- a/Cargo.toml
+++ b/Cargo.toml
@@ -1,17 +1,21 @@
[package]
name = "docker-registry-api"
-version = "0.1.0"
+version = "0.1.1"
authors = ["Sébastien Santoro <dereckson@espace-win.org>"]
edition = "2018"
[dependencies]
-env_logger = "^0.5.13"
-lazy_static = "1.1.0"
-limiting-factor = { version="^0.5.0", features = ["minimal"] }
-log = "^0.4.5"
-regex = "1.0.5"
-rocket = "^0.3.16"
-rocket_codegen = "^0.3.16"
-rocket_contrib = { version = "*", features = ["json"] }
-serde = "1.0"
-serde_derive = "1.0"
+env_logger = "^0.9.0"
+lazy_static = "^1.4.0"
+limiting-factor = { version="^0.7.1", features = ["minimal"] }
+log = "^0.4.14"
+regex = "^1.5.4"
+rocket = "^0.4.10"
+rocket_codegen = "^0.4.10"
+serde = "^1.0.130"
+serde_derive = "^1.0.130"
+
+[dependencies.rocket_contrib]
+version = "0.4.10"
+default-features = false
+features = ["json"]
diff --git a/src/app.rs b/src/app.rs
--- a/src/app.rs
+++ b/src/app.rs
@@ -2,6 +2,7 @@
use crate::requests::*;
use limiting_factor::kernel::MinimalApplication;
+use rocket_codegen::routes;
pub fn run () {
diff --git a/src/lib.rs b/src/lib.rs
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -1,5 +1,4 @@
-#![feature(plugin)]
-#![plugin(rocket_codegen)]
+#![feature(proc_macro_hygiene, decl_macro)]
pub mod app;
pub mod registry;
diff --git a/src/registry.rs b/src/registry.rs
--- a/src/registry.rs
+++ b/src/registry.rs
@@ -11,8 +11,8 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/// Represents a Docker registry
-#[serde(rename_all = "camelCase")]
#[derive(Serialize, Deserialize, Clone)]
+#[serde(rename_all = "camelCase")]
pub struct Registry {
#[serde(skip_serializing)]
pub directory: String,
@@ -121,8 +121,8 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/// Represents a repository from the Docker registry
-#[serde(rename_all = "camelCase")]
#[derive(Serialize, Deserialize)]
+#[serde(rename_all = "camelCase")]
pub struct Repository {
#[serde(skip_serializing)]
pub directory: String,
@@ -204,8 +204,8 @@
- - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - */
/// Represents a repository tag
-#[serde(rename_all = "camelCase")]
#[derive(Serialize, Deserialize, Clone)]
+#[serde(rename_all = "camelCase")]
pub struct Tag {
pub name: String,
pub hash: String,
diff --git a/src/requests.rs b/src/requests.rs
--- a/src/requests.rs
+++ b/src/requests.rs
@@ -4,6 +4,8 @@
use crate::registry::{Registry, Repository};
use limiting_factor::api::replies::*;
+use rocket::http::Status;
+use rocket_codegen::get;
#[get("/status")]
pub fn status() -> &'static str {
@@ -30,12 +32,12 @@
.get_repository(&repository_name);
match repository {
- None => Err(build_bad_request_response()),
+ None => Err(Status::BadRequest),
Some(repo) => {
if repo.exists() {
Ok(repo.into_json_response()?)
} else {
- Err(build_not_found_response())
+ Err(Status::NotFound)
}
}
}
@@ -51,7 +53,7 @@
#[get("/repository/findByLayer/<hash>")]
pub fn find_repository_by_layer(hash: String) -> ApiJsonResponse<Vec<Repository>> {
if !Repository::is_valid_hash(&hash) {
- return Err(build_bad_request_response())
+ return Err(Status::BadRequest)
}
Registry::with_default_location()
@@ -62,7 +64,7 @@
#[get("/repository/findByImage/<hash>")]
pub fn find_repository_by_image(hash: String) -> ApiJsonResponse<Vec<Repository>> {
if !Repository::is_valid_hash(&hash) {
- return Err(build_bad_request_response())
+ return Err(Status::BadRequest)
}
Registry::with_default_location()
File Metadata
Details
Attached
Mime Type
text/plain
Expires
Tue, Nov 19, 03:27 (11 h, 5 m)
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
2251825
Default Alt Text
D2429.id6108.diff (3 KB)
Attached To
Mode
D2429: Update dependencies and Rust target version
Attached
Detach File
Event Timeline
Log In to Comment