Skip to content

Commit 3146b6d

Browse files
committed
-implemented some http caching hints
-some documentation
1 parent 365ce85 commit 3146b6d

File tree

3 files changed

+15
-2
lines changed

3 files changed

+15
-2
lines changed

README.md

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,3 +2,13 @@
22
[![Build docker images](https://github.com/aczwink/OpenDistributedFileStorage/actions/workflows/docker-image.yml/badge.svg)](https://github.com/aczwink/OpenDistributedFileStorage/actions/workflows/docker-image.yml)
33

44
A web-based file storage service with distributed storage targets
5+
6+
## Documentation
7+
8+
### Concepts
9+
* A blob is an immutable sequence of bytes defined by its sha256 hash.
10+
* A blob is partitioned into multiple blocks.
11+
* A blob block is also an immutable sequence of bytes defined by its sha256 hash.
12+
* A blob block is stored within one storage block.
13+
14+
TODO: documentation about storage blocks

service/src/api/files.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenDistributedFileStorage
3-
* Copyright (C) 2024 Amir Czwink ([email protected])
3+
* Copyright (C) 2024-2025 Amir Czwink ([email protected])
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU Affero General Public License as published by
@@ -279,6 +279,7 @@ class _api_
279279
const result = await this.fileDownloadService.DownloadBlob(blobId, accessToken.sub);
280280
return Ok(result.stream, {
281281
"Content-Length": result.size,
282+
"Cache-Control": "max-age=31536000, immutable"
282283
});
283284
}
284285

service/src/api/stream.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/**
22
* OpenDistributedFileStorage
3-
* Copyright (C) 2024 Amir Czwink ([email protected])
3+
* Copyright (C) 2024-2025 Amir Czwink ([email protected])
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU Affero General Public License as published by
@@ -46,6 +46,7 @@ class _api_
4646
{
4747
const result = await this.fileDownloadService.DownloadBlob(blobId, userId);
4848
return Ok(result.stream, {
49+
"Cache-Control": "max-age=31536000, immutable",
4950
"Content-Length": result.size,
5051
});
5152
}
@@ -58,6 +59,7 @@ class _api_
5859
const slice = await this.fileDownloadService.DownloadBlobSlice(blobId, parsed.start, parsed.length);
5960
return PartialContent(slice, {
6061
"Accept-Ranges": "bytes",
62+
"Cache-Control": "max-age=31536000, immutable",
6163
"Content-Range": `bytes ${parsed.start}-${parsed.end}/${totalSize}`,
6264
"Content-Length": slice.byteLength,
6365
"Content-Type": {

0 commit comments

Comments
 (0)