Skip to content
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

Feature/list files #128

Merged
merged 27 commits into from Jul 14, 2018
Merged

Feature/list files #128

merged 27 commits into from Jul 14, 2018

Conversation

jcnelson
Copy link
Member

@jcnelson jcnelson commented Jul 2, 2018

This PR adds support for POST /list-files/${address}/ as well as supporting documentation.

How to Test

You send a POST request to /list-files/${address}/ with content-type: application/json that encodes the driver-specific page identifier (initially null). You get back a JSON object with the structure {"entries": [list of file names], "page": "driver-specific-next-page-token"}. The configuration file specifies the maximum length of entries, under the pageSize directive.

Sample disk driver configuration:

{
  "servername": "localhost",
  "port": 4000,
  "driver": "disk",
  "readURL": "http://localhost:4001/",
  "proofsConfig": {
    "proofsRequired" : 0
  },
  "diskSettings": {
     "storageRootDirectory": "/tmp/gaia-disk"
  },
  "pageSize": 20,
  "argsTransport": {
    "level": "debug",
    "handleExceptions": true,
    "stringify": true,
    "timestamp": true,
    "colorize": false,
    "json": true
  }
}

Contents of /tmp/gaia-disk/:

$ ls /tmp/gaia-disk/1GNJ12dwU4F5vpVXZBH4Pm5sKNszEgGko6/ | more
gaia-config.json
gaia-config.json.10
gaia-config.json.10.sig
gaia-config.json.11
gaia-config.json.11.sig
gaia-config.json.12
gaia-config.json.12.sig
gaia-config.json.13
gaia-config.json.13.sig
gaia-config.json.2
gaia-config.json.3
gaia-config.json.4
gaia-config.json.4.sig
gaia-config.json.5
gaia-config.json.5.sig
gaia-config.json.6
gaia-config.json.6.sig
gaia-config.json.7
gaia-config.json.7.sig
gaia-config.json.8
gaia-config.json.8.sig
gaia-config.json.9
gaia-config.json.9.sig

Sample POST payload:

{'page': '0'}

Sample response:

{ entries:
   [ 'gaia-config.json',
     'gaia-config.json.10',
     'gaia-config.json.10.sig',
     'gaia-config.json.11',
     'gaia-config.json.11.sig',
     'gaia-config.json.12',
     'gaia-config.json.12.sig',
     'gaia-config.json.13',
     'gaia-config.json.13.sig',
     'gaia-config.json.2',
     'gaia-config.json.3',
     'gaia-config.json.4',
     'gaia-config.json.4.sig',
     'gaia-config.json.5',
     'gaia-config.json.5.sig',
     'gaia-config.json.6',
     'gaia-config.json.6.sig',
     'gaia-config.json.7',
     'gaia-config.json.7.sig',
     'gaia-config.json.8' ],
  page: '1' }

Sample POST payload, as a follow-up to the above:

{'page': '1'}

Sample response:

{ entries:
   [ 'gaia-config.json.8.sig',
     'gaia-config.json.9',
     'gaia-config.json.9.sig' ],
  page: '2' }

You can test this with blockstack-cli:

$ blockstack-cli gaia_listfiles http://localhost:4000 304d7f6f1cf78a9260648f656deca0feec014be23d96ed190dd5ca45128fafac

kantai and others added 24 commits May 17, 2018 17:13
…fication (which takes a prefix and a page identifier)
…nfigurations. Still TODO: add mocking for list-files
@x5engine
Copy link

x5engine commented Jul 8, 2018

Hello Guys, can you please add AppendToFile ?

it will be a huge performance benefiets for GAIA and the apps built so they won't have to getFile the full file then upload it again!
What do you think? Thanks

Append to an object or array in the file...

@jcnelson
Copy link
Member Author

jcnelson commented Jul 8, 2018

@meteorplus please open this as a separate issue

@CLAassistant
Copy link

CLAassistant commented Jul 14, 2018

CLA assistant check
All committers have signed the CLA.

@kantai
Copy link
Member

kantai commented Jul 14, 2018

This worked great for me, thanks @jcnelson -- merging into develop now.

@kantai kantai merged commit 90b2a6c into develop Jul 14, 2018
@criadoperez criadoperez deleted the feature/list-files branch June 17, 2022 01:28
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

4 participants