-
Notifications
You must be signed in to change notification settings - Fork 42
Stable infinite files #1693
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Merged
Stable infinite files #1693
Changes from all commits
Commits
Show all changes
126 commits
Select commit
Hold shift + click to select a range
84da0c5
add large files example
bdemann 0f97f8e
first pass as upload files
bdemann 79687d9
add back end
bdemann 9a45c2d
rename to asset uploader
bdemann 90bf56c
Add and reorganize assets
bdemann 45b4fc6
checkpoint
bdemann 0aa6cad
update with broken length
bdemann c2d602a
upload single assets
bdemann e4ec925
rename to dfx entry to assets_large
bdemann bbd0244
create file generator
bdemann 1e34930
update for easier size control
bdemann 805101f
file generator does random bytes, better logs,
bdemann 3fb943e
Add chunk write for large assets
bdemann b3c10ae
improve signature for upload-assets and combine with upload-asset
bdemann 06e6d1e
add support for file generation bigger than 2GiB
bdemann 2cd309d
remove test limit
bdemann 7d71cf0
use read stream
bdemann 9743423
checkpoint, up to 250GB hashing
bdemann 448ef1e
new hashing system
bdemann 3091b85
Add file hashing to node side
bdemann e88845d
set up most of the tests
bdemann 1d2d980
try with production timing
bdemann 348bdc6
skip generation of 0B file
bdemann 5f4f5af
checkpoint
bdemann 477bd3d
fix write limit to accommodate larger files, add back more tests
bdemann 5daedb0
update Cargo.lock
bdemann 0777d4e
stable storage checkpoint
bdemann 9ab2ebc
clean up
bdemann 648fcfc
clean up
bdemann 377d1e9
kind of works checkpoint
bdemann 0971449
works for less than 19 writing chunks
bdemann 6bf50ed
fixup
bdemann 5fa1e42
checkpoint
bdemann fbd2d53
checkpoint
bdemann 21d3e8a
checkpoint
bdemann 6d25b5d
fixup
bdemann c95f9ee
fixup
bdemann eb732f5
better logging
bdemann 65b08b8
remove debugging prints
bdemann 93dd8c1
move upload_assets to it's own mod
bdemann bb835a9
move temp chunks to it's own mod
bdemann 559479a
use heap to store temp chunks
bdemann 6fb4f31
remove curled folder
bdemann 5a6af34
enable as many tests as will pass before running into the file limit
bdemann d25fc98
experiment with the test.yaml
bdemann f169fe9
fixup
bdemann 9a6fff9
improved logging
bdemann 8380d06
chmod in test.yml
bdemann 313cb98
add err to on err
bdemann 1e43392
fixup up into stuff with yml
bdemann d4f6118
make sure directories are created
bdemann eaa0066
fixup into file_generator
bdemann 719eec4
fix up the audio and video example, get deployment process ready for …
lastmjs b704be7
Merge pull request #1694 from demergent-labs/infinite-files-mainnet
bdemann 32438c5
checkpoint
bdemann a30ee2e
checkpoint before committing to createReadStream
bdemann 282f792
pr fixes checkpoint
bdemann 056777c
pr checkpoint
bdemann 01446e2
pr fixes checkpoint
bdemann cfbc79f
pr fixes checkpoint
bdemann dec54f8
add authentication
bdemann 768d4f1
finish tests
bdemann cc05737
rename function
bdemann e6ba76b
change dir name
bdemann fd56068
fixup
bdemann 643c6b3
rename temp_chunks to write_chunk
bdemann 0f60cc8
remove unused functions
bdemann a3c19c6
unify tests and file generation
bdemann ae974d6
pr fixes
bdemann 62a1913
pr fixes
bdemann bff885a
Merge branch 'main' into stable-infinite-files
bdemann 2d68941
rename upload assets
bdemann 8040a7e
rename folder
bdemann 5081529
fix dfx.json after name change
bdemann 1073b36
clean up
bdemann 241722a
make file_generator more declarative
bdemann c0818c9
make hash file more declarative
bdemann c6f976d
clean up file_uploader
bdemann 225909f
fix assets_large
bdemann 6c7f1a4
pr fixes
bdemann 58d5ce2
finish ts side
bdemann 81f24a7
fixup into ts side
bdemann 190e2a0
update logs
bdemann c6fbd6c
rename version
bdemann 2282e5c
pr fixes
bdemann ece2383
clean up versions
bdemann ec74897
make code more declarative
bdemann c85eecf
improved logging and hashing
bdemann f827135
fixup
bdemann d3e3cb8
Add support for 0 bytes files
bdemann cf132d0
await file total file upload
bdemann 6ce6cfc
Break up file_uploader
bdemann abf38ec
update paths
bdemann 2ce2b9a
remove files that weren't uploaded properly
bdemann 1a7a1cf
quick fix
bdemann c28f235
pr fixes
bdemann 44f1c1d
pr fixes
bdemann 879d6fa
checkpoint
bdemann 0243780
pr fixes
bdemann 2287d0e
fixup
bdemann 4151f1b
test
bdemann 64d8be5
move actors into separate folder
bdemann e9dc676
pr fixes included adding types to actors
bdemann de74bbe
rename hash actor
bdemann 3371e10
unify file methods into one actor
bdemann 0299db2
rename actor
bdemann 3f642b3
rename upload-files back to upload-assets
bdemann cdc3724
fixup into test
bdemann 01067a8
fixup
bdemann a836a81
make on_before_exist more declarative
bdemann 554b8c5
update _SERVICE types
bdemann c0ef78b
finish authorization tests
bdemann 63391fd
Merge branch 'main' into stable-infinite-files
bdemann 5637428
fix imports
bdemann f4d06e9
change from buffer to uint8array
bdemann f0e21c0
add filterAsync
bdemann c583f3e
better spacing
bdemann 7264b96
add return type
bdemann 2449615
rename and invert logic
bdemann edf835d
make more declarative
bdemann 4890e4d
change let to const
bdemann a4a0db0
update comment
bdemann f8b89cb
update percentage for 0 byte files
bdemann d519f55
add message at end
bdemann 9ed4da9
skip 2GiB tests
bdemann 8367faa
fixup
bdemann File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,94 @@ | ||
import { execSync } from 'child_process'; | ||
import { Secp256k1KeyIdentity } from '@dfinity/identity-secp256k1'; | ||
import { readFile } from 'fs/promises'; | ||
import { homedir } from 'os'; | ||
import { join } from 'path'; | ||
import { HttpAgent } from '@dfinity/agent'; | ||
|
||
export function getCanisterId(canisterName: string): string { | ||
return execSync( | ||
`dfx canister --network ${ | ||
process.env.DFX_NETWORK ?? 'local' | ||
} id ${canisterName}` | ||
) | ||
.toString() | ||
.trim(); | ||
} | ||
|
||
export function getWebServerPort(): string { | ||
return execSync(`dfx info webserver-port`).toString().trim(); | ||
} | ||
|
||
export function getCanisterOrigin(canisterName: string): string { | ||
return `http://${getCanisterId( | ||
canisterName | ||
)}.localhost:${getWebServerPort()}`; | ||
} | ||
|
||
export function getAgentHost(): string { | ||
return process.env.DFX_NETWORK === 'ic' | ||
? `https://icp-api.io` | ||
: `http://127.0.0.1:${getWebServerPort()}`; | ||
} | ||
|
||
export async function createAnonymousAgent() { | ||
const agent = new HttpAgent({ | ||
host: getAgentHost() | ||
}); | ||
|
||
if (process.env.DFX_NETWORK !== 'ic') { | ||
await agent.fetchRootKey(); | ||
} | ||
} | ||
|
||
export async function createAuthenticatedAgent( | ||
identityName?: string | ||
): Promise<HttpAgent> { | ||
const agent = new HttpAgent({ | ||
host: getAgentHost(), | ||
identity: getIdentity(identityName) | ||
}); | ||
|
||
if (process.env.DFX_NETWORK !== 'ic') { | ||
await agent.fetchRootKey(); | ||
} | ||
|
||
return agent; | ||
} | ||
|
||
export function getIdentityName(): string { | ||
return execSync(`dfx identity whoami`).toString().trim(); | ||
} | ||
|
||
export function generateIdentity(name: string) { | ||
execSync(`dfx identity new ${name} --storage-mode plaintext`); | ||
} | ||
|
||
export function useIdentity(name: string) { | ||
execSync(`dfx identity use ${name}`); | ||
} | ||
|
||
export function getIdentities(): string[] { | ||
const list = execSync(`dfx identity list`).toString().trim(); | ||
const identities = list.split('\n'); | ||
|
||
return identities; | ||
} | ||
|
||
export function removeIdentity(name: string) { | ||
execSync(`dfx identity remove ${name}`); | ||
} | ||
|
||
export async function getIdentity( | ||
identityName: string = getIdentityName() | ||
): Promise<Secp256k1KeyIdentity> { | ||
const identityPath = join( | ||
homedir(), | ||
'.config', | ||
'dfx', | ||
'identity', | ||
identityName, | ||
'identity.pem' | ||
); | ||
return Secp256k1KeyIdentity.fromPem(await readFile(identityPath, 'utf-8')); | ||
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,3 +1,6 @@ | ||
.azle | ||
.dfx | ||
node_modules | ||
src/backend/media/jordan_video_streaming_demo.mp4 | ||
bdemann marked this conversation as resolved.
Show resolved
Hide resolved
|
||
src/backend/media/popeye_the_sailor_meets_sindbad_the_sailor.mp4 | ||
src/backend/media/the_memphis_belle.mp4 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Uh oh!
There was an error while loading. Please reload this page.