Skip to content
This repository has been archived by the owner on Aug 2, 2021. It is now read-only.

HTTP API support for pinning contents #1658

Merged
merged 6 commits into from
Aug 14, 2019
Merged

HTTP API support for pinning contents #1658

merged 6 commits into from
Aug 14, 2019

Conversation

jmozah
Copy link
Collaborator

@jmozah jmozah commented Aug 8, 2019

Three HTTP API related to pinning is added

  1. bzz-pin: POST - for pinning a file
    bin-pin:/?IsRaw=true to pin a raw file
    bin-pin:/ to pin a collection
  2. bzz-pin: DELETE - for unpinning a file
  3. bzz-pin: GET - for listing pinned files

@jmozah jmozah requested review from acud and janos August 8, 2019 11:07
api/http/server.go Show resolved Hide resolved
api/http/server.go Outdated Show resolved Hide resolved
api/http/server.go Show resolved Hide resolved
api/http/server_test.go Show resolved Hide resolved
janos
janos previously approved these changes Aug 8, 2019
Copy link
Member

@janos janos left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM.

Copy link
Member

@acud acud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@jmozah I think that the change to expose the private fields on the pin struct is not needed if you implement the MarshalJSON/UnmarshalJSON methods (same issue like the other PR). Otherwise LGTM

api/http/server.go Outdated Show resolved Hide resolved
api/http/server.go Outdated Show resolved Hide resolved
api/http/server_test.go Outdated Show resolved Hide resolved
api/http/server_test.go Show resolved Hide resolved
api/http/server_test.go Show resolved Hide resolved
storage/pin/pin.go Show resolved Hide resolved
storage/pin/pin.go Outdated Show resolved Hide resolved
Copy link
Member

@acud acud left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just a couple of comments about method and type names in pin.go

Copy link
Member

@zelig zelig left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

approve with minor suggestions to rename a few things

@@ -128,6 +128,10 @@ func (u *URI) Hash() bool {
return u.Scheme == "bzz-hash"
}

func (u *URI) Pin() bool {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

comment exported method

isRaw bool
fileSize uint64
pinCounter uint64
// PinInfo is the struct that stores the information about pinned files
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should this just be Info. You know, no pkg prefix in names.
or call it Pin? maybe

type PinInfo struct {
Address storage.Address
IsRaw bool
FileSize uint64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Size?

Address storage.Address
IsRaw bool
FileSize uint64
PinCounter uint64
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

would it not be more intuitive to call this Chunks?

@skylenet skylenet added this to the 0.4.4 milestone Aug 14, 2019
@zelig zelig merged commit 12709bd into ethersphere:master Aug 14, 2019
Swarm Core - Sprint planning automation moved this from Backlog to Done Aug 14, 2019
chadsr added a commit to chadsr/swarm that referenced this pull request Sep 23, 2019
* 'master' of github.com:ethersphere/swarm:
  chunk, storage: chunk.Store multiple chunk Put (ethersphere#1681)
  storage: fix pyramid chunker and hasherstore possible deadlocks (ethersphere#1679)
  pss: Use distance to determine single guaranteed recipient (ethersphere#1672)
  storage: fix possible hasherstore deadlock on waitC channel (ethersphere#1674)
  network: Add adaptive capabilities message (ethersphere#1619)
  p2p/protocols, p2p/testing; conditional propagation of context (ethersphere#1648)
  api/http: remove unnecessary conversion (ethersphere#1673)
  storage: fix LazyChunkReader.join potential deadlock (ethersphere#1670)
  HTTP API support for pinning contents (ethersphere#1658)
  pot: Add Distance methods with tests (ethersphere#1621)
  README.md: Update Vendored Dependencies section (ethersphere#1667)
  network, p2p, vendor: move vendored p2p/testing under swarm (ethersphere#1647)
  build, vendor: use go modules for vendoring (ethersphere#1532)
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Projects
No open projects
Development

Successfully merging this pull request may close these issues.

None yet

5 participants