Skip to content
GitLab
Projects
Groups
Snippets
/
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
Menu
Open sidebar
Shinto C V
Pod backend
Commits
3b06a9a2
Unverified
Commit
3b06a9a2
authored
4 years ago
by
Vasili Novikov
Browse files
Options
Download
Email Patches
Plain Diff
Fix clippy warnings
parent
07498107
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
src/constants.rs
+3
-0
src/constants.rs
src/database_api.rs
+0
-8
src/database_api.rs
src/file_api.rs
+3
-7
src/file_api.rs
with
6 additions
and
15 deletions
+6
-15
src/constants.rs
+
3
-
0
View file @
3b06a9a2
...
...
@@ -4,3 +4,6 @@ pub const DATABASE_DIR: &str = "./data/db";
pub
const
DATABASE_SUFFIX
:
&
str
=
".db3"
;
pub
const
FILES_DIR
:
&
str
=
"./data/files"
;
/// Directory where fully uploaded and hash-checked files are stored
/// (in future, the files should also be s3-uploaded).
pub
const
FILES_FINAL_SUBDIR
:
&
str
=
"final"
;
This diff is collapsed.
Click to expand it.
src/database_api.rs
+
0
-
8
View file @
3b06a9a2
...
...
@@ -300,14 +300,6 @@ pub fn insert_string(tx: &Tx, item: Rowid, name: &str, value: &str) -> Result<()
Ok
(())
}
/// Insert a "BLOB storage class" into the strings TEXT column
/// See "Type Affinity": https://www.sqlite.org/datatype3.html
pub
fn
insert_string_blob
(
tx
:
&
Tx
,
item
:
Rowid
,
name
:
&
str
,
value
:
&
[
u8
])
->
Result
<
()
>
{
let
mut
stmt
=
tx
.prepare_cached
(
"INSERT INTO strings VALUES(?, ?, ?);"
)
?
;
stmt
.execute
(
params!
[
item
,
name
,
value
])
?
;
Ok
(())
}
pub
fn
delete_property
(
tx
:
&
Tx
,
item
:
Rowid
,
name
:
&
str
)
->
Result
<
()
>
{
let
mut
stmt
=
tx
.prepare_cached
(
"DELETE FROM integers WHERE item = ? AND name = ?;"
)
?
;
stmt
.execute
(
params!
[
item
,
name
])
?
;
...
...
This diff is collapsed.
Click to expand it.
src/file_api.rs
+
3
-
7
View file @
3b06a9a2
...
...
@@ -90,7 +90,7 @@ fn file_exists_on_disk(owner: &str, sha256: &str) -> Result<bool> {
fn
final_path
(
owner
:
&
str
,
sha256
:
&
str
)
->
Result
<
PathBuf
>
{
let
result
=
files_dir
()
?
;
let
final_dir
=
result
.join
(
owner
)
.join
(
FINAL_DIR
);
let
final_dir
=
result
.join
(
owner
)
.join
(
constants
::
FILES_
FINAL_
SUB
DIR
);
create_dir_all
(
&
final_dir
)
.map_err
(|
err
|
Error
{
code
:
StatusCode
::
INTERNAL_SERVER_ERROR
,
msg
:
format!
(
...
...
@@ -166,10 +166,10 @@ fn find_key_and_nonce_by_sha256(tx: &Transaction, sha256: &str) -> Result<(Vec<u
let
nonce
=
hex
::
decode
(
nonce
)
?
;
Ok
((
key
,
nonce
))
}
else
{
return
Err
(
Error
{
Err
(
Error
{
code
:
StatusCode
::
NOT_FOUND
,
msg
:
format!
(
"Item with sha256={} not found"
,
sha256
),
})
;
})
}
}
...
...
@@ -183,7 +183,3 @@ fn files_dir() -> Result<PathBuf> {
}
})
}
/// Directory where fully uploaded and hash-checked files are stored
/// (in future, the files should also be s3-uploaded).
const
FINAL_DIR
:
&
str
=
"final"
;
This diff is collapsed.
Click to expand it.
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment