GithubHelp home page GithubHelp logo

jdeepee / file-storage-zome Goto Github PK

View Code? Open in Web Editor NEW

This project forked from ryanhow/file-storage-zome

0.0 2.0 0.0 72 KB

A zome that can be mixed in to any DNA to provide basic file storage capabilities

License: MIT License

JavaScript 50.17% Rust 20.96% HTML 28.87%

file-storage-zome's Introduction

file-storage-zome

A zome that can be mixed in to any DNA to provide basic file storage capabilities.

This aims to be a community maintained project and will receive support but minimal contributions from the dev team

Requirements

There are several considerations for an efficient implementation of file/blob storage:

  • There is a limit of 4GB of WASM memory that can be used at any time
  • Files must be chunked to provide uniform data distribution in the DHT
  • There must be a way to validate that the file you receive is as expected

Specification

Files should be chunked outside the zome itself. A javascript reference implementation should be included in this repo which performs the chunking and restructuring operations

A manifest should describe a single file and how to retrieve all of the chunks. The hash of the manifest therefore becomes the address for retrieving the file. The manifest must contain:

  • An ordered list of the hashes/addresses of the chunks
  • Any additional metadata (e.g. description, file type etc)

validation logic must ensure that a manifest can only be stored in the DHT once all of the chunks are also stored


The zome should expose the following interface:

  • store_chunk(data: RawString) -> ZomeApiResult<Address>
  • store_manifest(manifest: Manifest) -> ZomeApiResult<Address>
  • get_chunk(address: Address) -> ZomeApiResult<RawString>
  • get_manifest(address: Address) -> ZomeApiResult<Manifest>

The javascript interface should expose higher level functions to the end user such as :

  • storeFile(bytes: UInt8Array): string | Error - returns the address of the manifest as a string
  • getFile(address: string): UInt8Array | Error - given the manifest address returns the restructured chunks

Getting Started

Clone the repo (Or better still, fork then clone, so you can work on it too)

To run the holochain portion

cd dna-src
hc run --package

To run the frontend

Open a new separate terminal (So the backend stays running in the other one)

Install the http-server utility npm install -g http-server (or use another lightweight http-server)

Then

cd ui
http-server

Open your web browser and upload and download some files

Current Status

File storage zome - There is currently scaffolding. It needs coding, validation and testing Client library - There is a es6 module that returns mocked data. Sample UI - This is running and using the lib. Application holochain data (where the list of files is storage) is currently mocked in the frontend.

Contributing

We follow the "fork-and-pull" Git workflow.

Fork the repo on GitHub
Clone the project to your own machine
Commit changes to your own branch
Push your work back up to your fork
Submit a Pull request so that we can review your changes

NOTE: Be sure to merge the latest from "upstream" before making a pull request

file-storage-zome's People

Contributors

willemolding avatar

Watchers

 avatar  avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.