subutai-io/cdn

Add new-formatted retriever function

Closed this issue · 3 comments

For refactoring purposes, we need to make a server application that will exist along with the current CDN application. Long in short, it will look like

* /
  * apt/
  * auth/
  * ...
  * server/
    * main.go
    * retriever.go
    * callbacks.go
  * ...

We need to add a retriever function.

The callback will build a query with a special method and pass this query to the retriever function. Retriever function will do its search using the search function and return a slice of files to the callback function.

Retriever function will take the following arguments:

1. fileID string
2. name string
3. owner string
4. token string
5. tags string
6. version string
7. limit int
8. offset int
9. repo string

Retrieve must return SearchResult structure that will have the following arguments:

1. fileID (MyBucket -> fileID)
2. owner (MyBucket -> fileID -> owner -> first key/value pair)
3. name (MyBucket -> fileID -> key:name)
4. repo (MyBucket -> fileID -> type -> buckets)
5. version (MyBucket -> fileID -> key:version)
6. scope (MyBucket -> fileID -> scope -> all key/value pairs)
7. md5 (MyBucket -> fileID -> hash -> key:md5)
8. sha256 (MyBucket -> fileID -> hash -> key:sha256)
9. size (MyBucket -> fileID -> size)
10. tag (MyBucket -> fileID -> tag)