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

swarm: push tags integration - request flow #1347

Open
wants to merge 20 commits into
base: swarm-rather-stable
from

Conversation

Projects
3 participants
@justelad
Copy link

commented Apr 23, 2019

this pr integrates the push tags into the low level components that actually do the bead-counting.
supersedes #1318

https://hackmd.io/9eWxJ_MJS8i04onWg49UBA?both

coincidentally resolves #1364 and fixes #1350

@justelad justelad requested a review from zelig Apr 23, 2019

@justelad justelad self-assigned this Apr 23, 2019

@justelad justelad referenced this pull request Apr 23, 2019

Closed

[WIP] Push tags #1318

@janos
Copy link

left a comment

There are compilations errors in swarm/api/http/test_server.go and swarm/fuse/swarmfs_test.go.

Show resolved Hide resolved cmd/swarm/swarm-smoke/upload_and_sync.go Outdated
Show resolved Hide resolved swarm/fuse/swarmfs_test.go Outdated
@justelad

This comment has been minimized.

Copy link
Author

commented Apr 23, 2019

I am aware of the linting and compilation errors. This is still WIP (but preliminary implementation is there).
As I've noted to @zelig, I have a bit of a problem with the original design, namely:

  1. the Tags.Inc method is not used since we need to pass around the Tag pointer anyway to the pyramid chunker
  2. As of such we don't really need this to be a sync.Map but just a normal map that points to Tag pointers
  3. I don't think we should pass the whole sync.Map to the chunker in order to do the increments. @janos @zelig WDYT?
  4. we can pass the pointer in the context but I don't think this is a nice solution. I think we should just pass the tag id in the context and propagate the concrete object wherever necessary

opinions?

@justelad justelad changed the title push tags integration [wip]push tags integration Apr 24, 2019

@@ -297,31 +300,6 @@ func (a *API) ResolveURI(ctx context.Context, uri *URI, credentials string) (sto
return addr, nil
}

// Put provides singleton manifest creation on top of FileStore store
func (a *API) Put(ctx context.Context, content string, contentType string, toEncrypt bool) (k storage.Address, wait func(context.Context) error, err error) {

This comment has been minimized.

Copy link
@justelad

justelad Apr 26, 2019

Author

this method was only used by tests. i think we should not export test helpers on public APIs. hence the functionality was removed from the API struct and duplicated wherever necessary

Show resolved Hide resolved swarm/chunk/tags.go Outdated
Show resolved Hide resolved swarm/storage/filestore.go Outdated
Show resolved Hide resolved swarm/storage/hasherstore.go Outdated
Show resolved Hide resolved swarm/storage/hasherstore.go Outdated
Show resolved Hide resolved swarm/storage/pyramid.go
Show resolved Hide resolved swarm/api/http/server.go
Show resolved Hide resolved swarm/chunk/tag.go
Show resolved Hide resolved swarm/chunk/tag.go
Show resolved Hide resolved swarm/chunk/tags.go Outdated
Show resolved Hide resolved swarm/storage/hasherstore.go Outdated
@zelig

This comment has been minimized.

Copy link

commented Apr 27, 2019

can we please work with incremental PRs? Again we cram eveything into this.
you said it is ready for review but all checks fail on travis
Comment exported functions and in general please explain what you are doing:

  • what is the unit for which a tag is defined
  • how do they get default names
  • what are we doing with reponse headers

My 2c:

  • First we should finish #1341, putting all related changes there.
  • This PR should be only about creating and passing around tags, tag and the context
    and chunker and hasherstore calling increment
  • Following PR: integrate in the response
@justelad

This comment has been minimized.

Copy link
Author

commented Apr 27, 2019

can we please work with incremental PRs? Again we cram eveything into this.

localstore integration was one PR, shed was one PR, new localstore was one PR (not integrated)

you said it is ready for review but all checks fail on travis

ready for review means i would have tagged it ready for review and removed the [wip]. i haven't but i told you it's coming along and you can give it a pass and see how its coming along.

First we should finish #1341, putting all related changes there.

There were two days between my last commit on that branch and the last review. Not sure what I was supposed to do in between.

@justelad

This comment has been minimized.

Copy link
Author

commented Apr 27, 2019

Following PR: integrate in the response

while working on this i figured there's not much use to integrate this in the response, since we lose the ability to pipe the returned hash values from swarm up to other processes/machine readable format. that's why i changed the DoneSplit() signature to set an associated root hash once the splitting has been done. this at a later stage could be queried against bzz-tag:/<swarm hash> and there a UI or JSON would be returned as a result of the Accept header

@zelig zelig added this to Backlog in Swarm via automation Apr 29, 2019

@zelig zelig moved this from Backlog to Warm in Swarm Apr 29, 2019

@justelad justelad changed the base branch from add-tags-struct to swarm-rather-stable Apr 30, 2019

@justelad justelad force-pushed the tagz-count branch 2 times, most recently from 8dc9f72 to 4f92cac Apr 30, 2019

swarm/chunk: add tags struct
swarm/chunk: address (some) PR comments

swarm/chunk: add seen field

swarm/chunk: change eta status call

swarm/chunk: address pr comments

swarm/chunk: address pr comments

swarm/chunk: address pr comments

swarm/chunk: remove ambiguity of total

swarm/api: wip add chunk totals

swarm/api: tag test-bed

swarm/api, swarm/chunk: wip rudimentary implementation for tag increments

swarm/api, swarm/storage: initial TestApiPut passes

swarm/api: remove logline

swarm: address PR comments

cmd, swarm: fix compilation errors

swarm/chunk: adjust test

swarm/chunk: adjust tests

swarm/chunk: pointers galore

swarm: fix tests and compilation

swarm/storage: change pyramid chunker append signature

swarm/api: make api tags private

swarm/api: add test for larger content

cmd, swarm: add test for http upload

swarm: remove deprecated and unused code, add swarm hash to DoneSplit signature

swarm/chunk: add marshalling for address field

swarm/api: add handle get tag handler, add tags for post raw

cmd/swarm: reinstate recursive flag

swarm/api: cleanup api test

swarm/api: cleanup api test

swarm/api/client: add client tag check to multipart upload

swarm/api/client: add more tag assertions to tests

swarm/api/http: test for correct tag size estimate according to Content-Length header

swarm/api/http: document test

swarm/api/http: uncomment test

swarm/storage: address pr comments

swarm/api: remove silly comment

@justelad justelad force-pushed the tagz-count branch from 4f92cac to cd10ff2 Apr 30, 2019

@zelig zelig referenced this pull request Apr 30, 2019

Open

push syncing - meta + timeline #1028

9 of 19 tasks complete
@justelad

This comment has been minimized.

Copy link
Author

commented May 1, 2019

@zelig this is ready for review.
This PR addresses: creation of tags, passing them around, increments on store, seen, split, including tests that assert this. the bzz-tag frontend endpoint stub has been removed and will be deferred to a later PR.

Still left TODO:

  • Return the tag uid with a response header for dapps to track tags starting with the chunking phase
  • Integrate to localstore with an index that tracks the tag vectors per chunk on the push index. I don't see a way around this since we have to increment a single tag with SENT/SYNCED statuses
  • Rename chunk.State modes to the same convention as in http.StatusNotFound
  • Create the bzz-tag endpoint that will allow queries to return either a UI or JSON with the progress bars

@justelad justelad changed the title [wip]push tags integration swarm: push tags integration - request flow May 1, 2019

Show resolved Hide resolved swarm/api/api_test.go Outdated
@zelig
Copy link

left a comment

nice one , getting there:

  • STORED increment should be after Put returns
  • if tests fail, we need syncronisation, ie wait for correct numbers with timeout
  • checkTag should work on one Tag
  • test helpers should be DRY-ed
  • chunk count estimation should become exact chunk counting and tested
Show resolved Hide resolved swarm/api/client/client.go Outdated
Show resolved Hide resolved swarm/api/client/client.go Outdated
Show resolved Hide resolved swarm/api/client/client_test.go Outdated
Show resolved Hide resolved swarm/api/client/client_test.go Outdated
Show resolved Hide resolved swarm/api/client/client_test.go Outdated
Show resolved Hide resolved swarm/api/http/server.go Outdated
Show resolved Hide resolved swarm/api/http/server_test.go Outdated
Show resolved Hide resolved swarm/network_test.go
Show resolved Hide resolved swarm/storage/hasherstore.go Outdated
Show resolved Hide resolved swarm/testutil/tag.go Outdated
Show resolved Hide resolved swarm/chunk/tags.go Outdated
Show resolved Hide resolved swarm/chunk/tags.go Outdated
@zelig
Copy link

left a comment

Show resolved Hide resolved swarm/api/http/server.go Outdated
Show resolved Hide resolved swarm/chunk/tag.go Outdated
Show resolved Hide resolved swarm/api/http/middleware.go
Show resolved Hide resolved swarm/chunk/tags_test.go Outdated
Show resolved Hide resolved swarm/chunk/tags_test.go Outdated
Show resolved Hide resolved swarm/storage/filestore.go Outdated
@zelig

zelig approved these changes May 4, 2019

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
You can’t perform that action at this time.