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

Migrate go-unixfs into unixfs/ipld-merkledag #36

Closed
wants to merge 409 commits into from
Closed
Show file tree
Hide file tree
Changes from 250 commits
Commits
Show all changes
409 commits
Select commit Hold shift + click to select a range
f964c08
Make unixio.DagReader an interface
Kubuxu Nov 21, 2016
7ba5859
Move proto-dag reader to separate file and change name
Kubuxu Nov 21, 2016
74797d3
Create bufDagReader
Kubuxu Nov 21, 2016
983e1ad
Remove NewRSNCFromBytes and use NewDagReader for recursive reading
Kubuxu Nov 22, 2016
888fcb0
Remove trailing new-line from pbdagreader.go
Kubuxu Nov 24, 2016
e45657c
bubble up go-datastore deps
whyrusleeping Nov 29, 2016
e7c5a13
Switch unixfs.Metadata.MimeType to optional
mib-kd743naq Dec 2, 2016
2a61b66
Add test for unixfs/format to reach 87% coverage.
zmackie Dec 9, 2016
8a065c0
Add Some Comments to unixfs/format
zmackie Dec 9, 2016
51e2f43
Fix typo and formatting issues.
kevina Jan 4, 2017
ca35576
update go-multihash and bubble up deps
whyrusleeping Feb 3, 2017
062ddb0
make raw leaves work with 'ipfs get'
whyrusleeping Mar 7, 2017
15a687e
implement an HAMT for unixfs directory sharding
whyrusleeping Aug 4, 2016
879a152
iterator technique for unixfs dir listing
whyrusleeping Nov 16, 2016
597a4d6
add more docs on hamt
whyrusleeping Nov 17, 2016
9ba4d3c
chekc that size input to newHamtShard is a power of two
whyrusleeping Nov 22, 2016
278446f
add global config switch for sharding
whyrusleeping Mar 22, 2017
03ab706
fix: multiple govet warnings
Kubuxu Mar 24, 2017
792ac24
fix go vet issues in hamt sharding PR
whyrusleeping Mar 24, 2017
29fcaf4
Merge pull request ipfs/go-unixfs#3824 from ipfs/fix/govet/some-error
whyrusleeping Mar 24, 2017
6d5d491
bubble up updates from go-multihash changes
whyrusleeping Mar 25, 2017
e0fc359
adder: add support for using CidV1
kevina Mar 3, 2017
f5e052f
merkeldag: change SetPrefix param to a pointer and reset the prefix o…
kevina Mar 24, 2017
a2fadbe
hamt: support using CIDv1 by allowing the prefix to be set
kevina Mar 31, 2017
06f8c9d
Documentation
kevina Apr 26, 2017
fc9235f
Fix gateway handling of sharded directories
whyrusleeping Apr 29, 2017
148ae18
Fix sharding memory growth, and fix resolver for unixfs paths
whyrusleeping Apr 30, 2017
9800a42
fix coreapi unixfs resolving
whyrusleeping Apr 30, 2017
f6f0c2a
apply the megacheck tool to improve code quality
zramsay May 31, 2017
4645a19
address PR comments; remove commented/dead code
zramsay Jun 1, 2017
369e45c
hamt: reinstate a useful debug function
zramsay Jun 1, 2017
a561dc3
Allow dagmodifier to be created (but not used) with raw nodes
whyrusleeping Jun 20, 2017
4444340
Finish basic support for raw nodes in dag modifier.
kevina Jun 20, 2017
47eb340
dagmodifer: refactor appendData method
kevina Jun 21, 2017
3588587
blocks: gx import go-block-format
Stebalien Jun 18, 2017
b8e07ac
Update go-datastore to 1.2.2, go-cid to 0.7.16
magik6k Jul 4, 2017
04507c4
update go-multihash and bubble up changes
whyrusleeping Jul 12, 2017
ee07139
gx: update go-cid, go-multibase, base32
Stebalien Aug 29, 2017
ee2fd8a
gateway: fix seeker can't seek on specific files
magik6k Oct 18, 2017
c3c581e
gateway: custom seeker for files
magik6k Oct 18, 2017
2ccc009
Test raw leaves in trickle dag tests.
kevina Aug 5, 2017
171439e
Provide support for raw leaves in DAG modifier.
kevina Aug 8, 2017
8f1d323
Enable CidV1 (and other prefixes) in the Dag Modifier.
kevina Aug 8, 2017
12a5d3f
Test for alternative hash function in Dag Modifier.
kevina Aug 8, 2017
b813202
mfs: inherit CID prefix from from parent directory
kevina Aug 16, 2017
64fbc5f
Documentation.
kevina Oct 19, 2017
f4c8105
Merge pull request ipfs/go-unixfs#4320 from ipfs/fix/gateway-seeker
whyrusleeping Oct 20, 2017
681df98
fix hamt delete issue
whyrusleeping Nov 18, 2017
270bca5
appease codeclimate
whyrusleeping Dec 4, 2017
89ec86e
gx: update go-multihash
Stebalien Dec 4, 2017
b2fad7a
clear out memory after reads from the dagreader
whyrusleeping Dec 26, 2017
fe596ec
test promised don't get allocated where not wanted
whyrusleeping Dec 31, 2017
eb07576
gx: mass update
Stebalien Jan 24, 2018
c4d3711
dagmodifier: remove useless offset update
Stebalien Jan 25, 2018
c7e24d3
merkledag: switch to new dag interface
Stebalien Jan 25, 2018
7e79425
make code-climate happier
Stebalien Jan 25, 2018
9a01fd9
rename import of go-ipld-format from node/format to ipld
Stebalien Jan 29, 2018
e8fd218
Docs: golint-ify "importers" module
hsanjuan Feb 1, 2018
54f0755
Use a bitswap session for 'Cat'
whyrusleeping Feb 2, 2018
afc01af
Merge pull request ipfs/go-unixfs#4640 from ipfs/doc/godoc-importer
whyrusleeping Feb 3, 2018
a9f92d6
Golint: unixfs main module
hsanjuan Feb 6, 2018
39c6ed6
Golint: unixfs/archive
hsanjuan Feb 6, 2018
070722d
Golint: unixfs/hamt
hsanjuan Feb 6, 2018
f0c664f
Golint: unixfs/mod unixfs/test
hsanjuan Feb 6, 2018
e0b56b8
Golint: unixfs/io
hsanjuan Feb 6, 2018
9f42275
Golint: make BufDagReader public
hsanjuan Feb 6, 2018
333ad9f
Golint: improve io.Find documentation
hsanjuan Feb 6, 2018
ca21623
unixfs/mod: use errors.New() for all defined errors
hsanjuan Feb 6, 2018
9ee6848
Golint: improve unixfs/dagreader.go comments
hsanjuan Feb 7, 2018
4361e5d
Golint: remove extra // in comment
hsanjuan Feb 7, 2018
fdcdaa4
WIP: Extract: importers/chunk module as go-ipfs-chunker
hsanjuan Feb 5, 2018
a3406ef
Fix missing rename in tests
hsanjuan Feb 5, 2018
7d57b45
go-ipfs-chunker: Use the stable gx'ed release
hsanjuan Feb 7, 2018
cae8f0e
Extract chunker: Use last gx'ed go-ipfs-chunker
hsanjuan Feb 8, 2018
fc3979f
Extract: chunker: rename "chunk" to "chunker" as it is more consistent
hsanjuan Feb 8, 2018
f93521e
unixfs: clean path in DagArchive
schomatis Feb 28, 2018
c8fec6c
misc: spelling of retrieval
Kubuxu Mar 15, 2018
f4ac36c
misc: Remove some dead code
magik6k Mar 19, 2018
dff0b18
Merge pull request ipfs/go-unixfs#4819 from ipfs/misc/retreival
whyrusleeping Mar 23, 2018
3e69036
don't make assumptions about readers in the dagmodifier
Stebalien Mar 8, 2018
9c1d1eb
don't assume that Read reads all available bytes in pbdagreader
Stebalien Mar 8, 2018
4a6cdea
pbreader: use ReadFull instead of reimplementing it
Kubuxu Mar 8, 2018
99ac666
make the tar writer handle sharded ipfs directories
Stebalien Mar 23, 2018
cec29df
fix error when encountering a sharded directory when expecting a file
Stebalien Mar 23, 2018
94f7e11
appease go lint
Stebalien Mar 24, 2018
ead1919
don't resolve children unnecessarily when listing a sharded directory
Stebalien Mar 27, 2018
53cf6f3
fix hamt node not protobuf error
Stebalien Mar 28, 2018
6e32b89
remove redundant validation logic
Stebalien Mar 28, 2018
de46c67
faster hamt logic
Stebalien Mar 29, 2018
71e4296
add benchmark for hamt walking
Stebalien Mar 29, 2018
af6e5e1
fix error style
magik6k Mar 18, 2018
7c486c4
misc: Fix a few typos
magik6k Mar 19, 2018
ad9ad88
Merge pull request ipfs/go-unixfs#4889 from ipfs/feat/faster-hamt
whyrusleeping Apr 8, 2018
86e3c4e
dag: deduplicate AddNodeLinkClean into AddNodeLink
schomatis Apr 16, 2018
b343653
fix json
hsanjuan Apr 19, 2018
846db38
Merge pull request ipfs/go-unixfs#4835 from ipfs/fix/typos
whyrusleeping Apr 20, 2018
411bc55
Merge pull request ipfs/go-unixfs#4943 from ipfs/lgierth-patch-1
whyrusleeping Apr 20, 2018
d969df8
Merge pull request ipfs/go-unixfs#4833 from ipfs/misc/remove-dead-code
whyrusleeping Apr 20, 2018
69bb5d7
update deps
Stebalien May 4, 2018
218c98c
gx update go-log, sys, go-crypto
Stebalien Jun 9, 2018
d31234f
unixfs: integrate `pb.Data` into `FSNode`
schomatis Jun 8, 2018
974d681
Merge pull request ipfs/go-unixfs#5098 from schomatis/feat/unixfs/fsn…
whyrusleeping Jun 13, 2018
5e73a63
gx update
Stebalien Jun 26, 2018
d4dc689
use `copy` instead of looping
Stebalien Jun 27, 2018
9087fd9
better handle context cancellations in the PBDagReader
Stebalien Jun 28, 2018
25793fb
always prefetch at least 5 blocks ahead
Stebalien Jun 28, 2018
0c84daf
test dag reader context cancellation
Stebalien Jun 28, 2018
b888b90
dagreader: remove `Offset()` method
schomatis Jul 5, 2018
90cc078
explain when a promise can be canceled in pbdagreader
Stebalien Jul 6, 2018
a414fab
pbdagreader: use FSNode instead of protobuf structure
schomatis Jul 5, 2018
e62d6ca
unixfs: remove `Get` prefix from `FSNode` accessors
schomatis Jul 6, 2018
36dc851
unixfs: add a directory interface
schomatis Jun 27, 2018
5d997d4
unixfs: remove unused `ShardSplitThreshold` variable
schomatis Jul 9, 2018
c975f3a
Merge pull request ipfs/go-unixfs#5189 from schomatis/feat/pbdagreade…
whyrusleeping Jul 16, 2018
093a56c
Merge pull request ipfs/go-unixfs#5160 from schomatis/feat/unixfs/dir…
whyrusleeping Jul 16, 2018
f6a543b
unixfs: fix `FSNode` accessor in `NewDirectoryFromNode`
schomatis Jul 16, 2018
a5f59ed
unixfs: refactor switch in `precalcNextBuf`
schomatis Jul 16, 2018
5b5f2a5
unixfs: split `precalcNextBuf`
schomatis Jul 16, 2018
82da3d0
update go-cid
Stebalien Jul 16, 2018
67d8b8b
Merge pull request ipfs/go-unixfs#5162 from ipfs/feat/improve-preload
whyrusleeping Jul 17, 2018
b239cef
fix truncating when already at the correct size
Stebalien Dec 22, 2017
fa08b02
unixfs: fix `dagTruncate` to preserve node type
schomatis Jul 11, 2018
c044506
unixfs/mod: add test to `Truncate` to the same size
schomatis Jul 18, 2018
869fefa
Merge pull request ipfs/go-unixfs#5237 from schomatis/fix/unixfs/dag-…
whyrusleeping Jul 18, 2018
691582a
test: testLargeWriteChunks: seek before reading
schomatis Jul 23, 2018
4e905a1
move dagutils package to top level in preparation for merkledag extra…
whyrusleeping Jul 27, 2018
1187911
Extract dagservice, move dagutils to top level
whyrusleeping Jul 28, 2018
82f7fb6
move importers to unixfs directory
whyrusleeping Jul 30, 2018
66b1ef4
packageify
whyrusleeping Jul 30, 2018
d77bf9d
fix import in test
whyrusleeping Jul 30, 2018
ed43a84
update gogo protobuf
Stebalien Aug 8, 2018
3ece1ca
add stablecid test
Stebalien Aug 8, 2018
1a9f048
Merge pull request ipfs/go-unixfs#6 from ipfs/feat/protobuf
Stebalien Aug 9, 2018
33b6f1b
gx updates
kevina Aug 10, 2018
a0c04d6
Update to use new Builder interface for creating CIDs.
kevina Aug 11, 2018
86f106a
Rename Prefix in names to CidBuilder when a builder is used.
kevina Aug 11, 2018
23db24d
Merge pull request ipfs/go-unixfs#7 from ipfs/kevina/builder
kevina Aug 12, 2018
6b20142
nit: make dagTruncate a method on DagModifier
magik6k Aug 31, 2018
f71a52e
Merge pull request ipfs/go-unixfs#13 from ipfs/nit/dagserv-truncate
Stebalien Aug 31, 2018
a066ae8
gx update and fix code to use new Cid type
kevina Sep 7, 2018
451ed98
feat(io): add IsDir function
overbool Sep 20, 2018
817d4bc
fix(fsnode): issue #17
overbool Sep 20, 2018
dc942e2
Merge pull request ipfs/go-unixfs#18 from overbool/fix/issue-#17
Stebalien Sep 24, 2018
f8b7ccb
fix(type): issue #23
overbool Sep 26, 2018
a9fc5f7
gx publish 1.1.4
kevina Oct 4, 2018
c877768
Use EnumerateChildrenAsync in EnumLinks
hannahhoward Sep 21, 2018
c37910f
Fix tests to pass
michaelavila Sep 27, 2018
38753ab
Add CID set tracking to shard enumeration
hannahhoward Oct 1, 2018
70b9858
Refactor for readability, consistency
hannahhoward Oct 2, 2018
7a3f606
Minor optimizations and error checks
hannahhoward Oct 4, 2018
faac1ac
Merge pull request ipfs/go-unixfs#19 from ipfs/features/speed-up-shar…
hannahhoward Oct 5, 2018
2430d89
fix(resolve): issue #31
overbool Oct 10, 2018
86234d1
fix(resolve): replace switch with if
overbool Oct 10, 2018
aa9000c
gx: update to use extracted go-ipfs-files
magik6k Oct 16, 2018
ed5ccd8
Merge pull request ipfs/go-unixfs#36 from ipfs/gx/update-extract-files
Stebalien Oct 16, 2018
0819e49
refactor(hamt): remove child interface from hamt pkg
overbool Oct 9, 2018
3d2ca00
fix(hamt): modify isValueNode
overbool Oct 16, 2018
9ce83a7
fix(hamt): add error in makeShardValue
overbool Oct 16, 2018
53cf594
Fix #27: Remove batching from importers
hsanjuan Oct 19, 2018
0aa1b1a
Merge pull request ipfs/go-unixfs#41 from ipfs/fix/27-remove-batching
hsanjuan Oct 26, 2018
49e1beb
correctly handle offsets bigger than file size
kjzz Oct 12, 2018
27aab7c
document testDagSync function
kjzz Oct 24, 2018
0b686b3
feat(Directory): Add EnumLinksAsync method
hannahhoward Oct 17, 2018
38813bc
Add context cancelling logic
hannahhoward Oct 17, 2018
fdba36f
Convert formatting in hamt links to remove bit prefix
hannahhoward Oct 18, 2018
23bb6cc
Force processing of context cancellation first
hannahhoward Oct 18, 2018
9209540
Emit errors once at end
hannahhoward Oct 18, 2018
4fb5d04
feat(EnumLinksAsync): Remove error since it's unused
hannahhoward Oct 29, 2018
05c5c66
Merge pull request ipfs/go-unixfs#39 from ipfs/features/streaming-ls-…
hannahhoward Oct 30, 2018
8fd64e0
Fix comments in helpers
Sep 27, 2018
6fc298d
Fix typo in helpers
Dec 4, 2018
ad98094
fix a potential overflow bug
Stebalien Dec 21, 2018
19e8616
keep the full murmur128 hash
Stebalien Dec 21, 2018
6751eeb
return the sharded directory error from the hash bits helper
Stebalien Dec 21, 2018
49899f3
Merge pull request ipfs/go-unixfs#53 from ipfs/fix/handle-overflow
Stebalien Dec 21, 2018
70995aa
refactor(hamt): remove protonode
overbool Oct 19, 2018
3af6b19
hamt: wrap the manipulation about child and link
overbool Nov 5, 2018
95ccb13
hamt: rename to distinguish between child and slice indexes
schomatis Jan 15, 2019
e339a8a
dag: add fsNodeType in NewLeafNode and NewLeafDataNode
Aug 16, 2018
b366619
Docs: update balanced builder document
Aug 16, 2018
2e71d88
dag: remove `UnixfsNode` in Layout of trickledag
Aug 16, 2018
60520f6
Trickle: add new functions for FSNodeOverDag
Nov 12, 2018
820464e
dag: remove `UnixfsNode` in Append of trickledag
Dec 8, 2018
adc3d6f
dag: remove fillTrickleRec
Dec 25, 2018
ff781e4
dag: remove trickleDepthInfo
Dec 25, 2018
1f94183
dag: remove the old FillNodeLayer
Dec 26, 2018
a486c10
dag: Remove UnixfsNode
Dec 26, 2018
c041849
trickle: document `fillTrickleRec` and `trickleDepthInfo`
schomatis Jan 15, 2019
f5a1c57
trickle: rename variables according to new `trickleDepthInfo` names
schomatis Jan 16, 2019
74cbcdd
helpers: doc and TODOs
schomatis Jan 16, 2019
73648ee
mod: `TestDagSync`, seek before reading
schomatis Jan 17, 2019
6b7dd19
Enforce refs on files when using nocopy
magik6k Jan 14, 2019
f550184
fix tests after DagBuilder changes
magik6k Jan 14, 2019
bcbaa48
Merge pull request ipfs/go-unixfs#56 from ipfs/fix/nocopy-errors
Stebalien Jan 23, 2019
c9a5b1c
unixfs: decouple the DAG traversal logic from the DAG reader
schomatis Jul 13, 2018
f7315c6
io: implement a performant `WriteTo` version in the DAG reader
schomatis Jan 18, 2019
0f439d3
io: return nil when EOF is reached in WriteTo
magik6k Jan 28, 2019
ec82461
io: correctly handle seek offset with io.SeekEnd
magik6k Jan 28, 2019
726f009
Merge pull request ipfs/go-unixfs#60 from ipfs/feat/dag-reader/use-wa…
Stebalien Jan 30, 2019
6d08126
archive: use files instead of ipld
magik6k Jan 24, 2019
702160a
generate archives from files instead of dag nodes
magik6k Jan 24, 2019
7afb385
move unixfile here from go-ipfs
magik6k Jan 24, 2019
e36ee4c
archiwe: move to go-ipfs get command
magik6k Jan 30, 2019
597a98a
Merge pull request ipfs/go-unixfs#59 from ipfs/misc/archive-refactor
Stebalien Jan 30, 2019
9f38cda
unixfile: precalc dir size
magik6k Jan 30, 2019
023e2b2
Merge pull request ipfs/go-unixfs#61 from ipfs/misc/archive-refactor
Stebalien Jan 30, 2019
de794c8
gx publish 1.3.6
Kubuxu Feb 18, 2019
71da1b0
chore: remove URL field
Stebalien May 16, 2019
4e3f0cb
Merge pull request ipfs/go-unixfs#72 from ipfs/fix/remove-urlstore-sp…
Stebalien May 17, 2019
f6a0a9f
fix: enumerate children
Stebalien Jul 11, 2019
856ed57
Merge pull request ipfs/go-unixfs#74 from ipfs/fix/enumerate-children
Stebalien Jul 11, 2019
43535fe
update the the last go-merkledag
MichaelMure Jul 24, 2019
2900da0
Merge pull request ipfs/go-unixfs#75 from MichaelMure/update-merkledag
Stebalien Jul 25, 2019
c001260
fix: return the correct error from RemoveChild
Stebalien Jul 26, 2019
e90e27d
Merge pull request ipfs/go-unixfs#76 from ipfs/fix/unlink
Stebalien Jul 26, 2019
3ab07f7
doc: add a lead maintainer
Stebalien Sep 19, 2019
d4ae9bc
fix: correctly handle symlink file sizes
Stebalien Sep 26, 2019
ec44ab0
Merge pull request ipfs/go-unixfs#78 from ipfs/fix/file-size
Stebalien Sep 26, 2019
5e0a55b
fix(dagreader): remove a buggy workaround for a gateway issue
Stebalien Jan 4, 2020
4fd686d
fix(io): make resetPosition actually reset everything
Stebalien Jan 6, 2020
db2c232
Merge pull request ipfs/go-unixfs#80 from ipfs/fix/gateway-workaround
Stebalien Jan 6, 2020
dbef019
fix: fix a panic when deleting
Stebalien Feb 7, 2020
8d85245
Merge pull request ipfs/go-unixfs#81 from ipfs/fix/panic-on-delete
Stebalien Feb 7, 2020
205c66e
io/dagreader.go
Apr 16, 2021
e633f8d
Fix in size func
Apr 16, 2021
1cc69fd
Merge pull request ipfs/go-unixfs#88 from coryschwartz/fix/incorrect-…
Stebalien Apr 21, 2021
fbbd1cb
feat: add UpgradeableDirectory
schomatis May 5, 2021
99000c2
add test
schomatis May 6, 2021
98b5e79
fix: add pointer receiver
schomatis May 6, 2021
5793371
go fmt
schomatis May 6, 2021
dd0414e
feat: switch to HAMT based on size (#91)
schomatis May 7, 2021
c3ba71b
fix: always return upgradeable instead of basic dir (#92)
schomatis May 19, 2021
8a073a3
fix(directory): initialize size when computing it
schomatis May 21, 2021
7f32b59
Merge pull request ipfs/go-unixfs#93 from ipfs/schomatis/fix/dir/comp…
aschmahmann May 21, 2021
0b52a20
fix staticcheck
marten-seemann Jun 2, 2021
4c706b7
Merge pull request ipfs/go-unixfs#95 from ipfs/fix-staticcheck
marten-seemann Jun 2, 2021
0da55fc
chore(deps): move bitfield to ipfs org
Stebalien Jun 11, 2021
4ccd452
Merge pull request ipfs/go-unixfs#98 from ipfs/chore/move-bitfield
Stebalien Jun 13, 2021
913b5d3
Size-based unsharding (#94)
schomatis Nov 12, 2021
73b424d
feat: plumb through datastore context changes
guseggert Oct 21, 2021
9f0925b
Make switchToSharding more efficient
hsanjuan Jun 15, 2022
902abd4
sync: update CI config files (#125)
web3-bot Aug 26, 2022
1940158
Fix: panic when childer is nil (#127)
ajnavarro Oct 12, 2022
3d4a8f1
chore: migrate files (#134)
hacdias Jan 12, 2023
f11c96f
Merge commits from ipfs/go-unixfs/master
Jorropo Jan 25, 2023
6995dd2
unixfs: move pb definitions out of ipld-merkledag
Jorropo Jan 25, 2023
e0712c2
unixfs: remove LICENSE file and cleanup README.md
Jorropo Jan 25, 2023
4185708
Merge branch migrate-block-format into unixfs
Jorropo Jan 26, 2023
a14ba29
unixfs: merge main back into unixfs
Jorropo Jan 31, 2023
041e499
unixfs/ipld-merkledag: merge main
Jorropo Feb 3, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
49 changes: 41 additions & 8 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,51 +3,84 @@ module github.com/ipfs/go-libipfs
go 1.19

require (
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137
github.com/benbjohnson/clock v1.3.0
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3
github.com/gogo/protobuf v1.3.2
github.com/gorilla/mux v1.8.0
github.com/ipfs/go-bitfield v1.0.0
github.com/ipfs/go-block-format v0.0.3
github.com/ipfs/go-blockservice v0.5.0
github.com/ipfs/go-cid v0.3.2
github.com/ipfs/go-datastore v0.6.0
github.com/ipfs/go-ipfs-blockstore v1.2.0
github.com/ipfs/go-ipfs-chunker v0.0.5
github.com/ipfs/go-ipfs-exchange-offline v0.3.0
github.com/ipfs/go-ipfs-posinfo v0.0.1
github.com/ipfs/go-ipfs-util v0.0.2
github.com/ipfs/go-ipld-format v0.3.1
github.com/ipfs/go-ipns v0.3.0
github.com/ipfs/go-log v1.0.5
github.com/ipfs/go-log/v2 v2.5.1
github.com/ipfs/go-merkledag v0.9.0
github.com/libp2p/go-libp2p v0.23.4
github.com/libp2p/go-libp2p-record v0.2.0
github.com/multiformats/go-multiaddr v0.8.0
github.com/multiformats/go-multibase v0.1.1
github.com/multiformats/go-multihash v0.2.1
github.com/samber/lo v1.36.0
github.com/spaolacci/murmur3 v1.1.0
github.com/stretchr/testify v1.8.1
go.opencensus.io v0.23.0
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/decred/dcrd/dcrec/secp256k1/v4 v4.1.0 // indirect
github.com/gogo/protobuf v1.3.2 // indirect
github.com/ipfs/go-ipfs-util v0.0.2 // indirect
github.com/ipld/go-ipld-prime v0.9.0 // indirect
github.com/klauspost/cpuid/v2 v2.1.1 // indirect
github.com/go-logr/logr v1.2.3 // indirect
github.com/go-logr/stdr v1.2.2 // indirect
github.com/google/uuid v1.3.0 // indirect
github.com/hashicorp/golang-lru v0.5.4 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect
github.com/ipfs/go-ipfs-exchange-interface v0.2.0 // indirect
github.com/ipfs/go-ipld-cbor v0.0.6 // indirect
github.com/ipfs/go-ipld-legacy v0.1.1 // indirect
github.com/ipfs/go-metrics-interface v0.0.1 // indirect
github.com/ipfs/go-verifcid v0.0.2 // indirect
github.com/ipld/go-codec-dagpb v1.5.0 // indirect
github.com/ipld/go-ipld-prime v0.18.0 // indirect
github.com/jbenet/goprocess v0.1.4 // indirect
github.com/klauspost/cpuid/v2 v2.1.2 // indirect
github.com/libp2p/go-buffer-pool v0.1.0 // indirect
github.com/libp2p/go-openssl v0.1.0 // indirect
github.com/mattn/go-isatty v0.0.16 // indirect
github.com/mattn/go-isatty v0.0.17 // indirect
github.com/mattn/go-pointer v0.0.1 // indirect
github.com/minio/sha256-simd v1.0.0 // indirect
github.com/mr-tron/base58 v1.2.0 // indirect
github.com/multiformats/go-base32 v0.1.0 // indirect
github.com/multiformats/go-base36 v0.1.0 // indirect
github.com/multiformats/go-multicodec v0.6.0 // indirect
github.com/multiformats/go-varint v0.0.6 // indirect
github.com/multiformats/go-varint v0.0.7 // indirect
github.com/opentracing/opentracing-go v1.2.0 // indirect
github.com/pkg/errors v0.9.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
github.com/polydawn/refmt v0.0.0-20190807091052-3d65705ee9f1 // indirect
github.com/polydawn/refmt v0.0.0-20201211092308-30ac6d18308e // indirect
github.com/spacemonkeygo/spacelog v0.0.0-20180420211403-2296661a0572 // indirect
github.com/spaolacci/murmur3 v1.1.0 // indirect
github.com/stretchr/objx v0.5.0 // indirect
github.com/whyrusleeping/cbor-gen v0.0.0-20221220214510-0333c149dec0 // indirect
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect
go.opentelemetry.io/otel v1.7.0 // indirect
go.opentelemetry.io/otel/trace v1.7.0 // indirect
go.uber.org/atomic v1.10.0 // indirect
go.uber.org/multierr v1.8.0 // indirect
go.uber.org/zap v1.23.0 // indirect
golang.org/x/crypto v0.0.0-20220525230936-793ad666bf5e // indirect
golang.org/x/exp v0.0.0-20220916125017-b168a2c6b86b // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/protobuf v1.28.1 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
lukechampine.com/blake3 v1.1.7 // indirect
)
177 changes: 169 additions & 8 deletions go.sum

Large diffs are not rendered by default.

21 changes: 21 additions & 0 deletions unixfs/ipld-merkledag/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
The MIT License (MIT)

Copyright (c) 2014-2018 Juan Batiz-Benet

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
Jorropo marked this conversation as resolved.
Show resolved Hide resolved
66 changes: 66 additions & 0 deletions unixfs/ipld-merkledag/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
go-unixfs
==================

[![](https://img.shields.io/badge/made%20by-Protocol%20Labs-blue.svg?style=flat-square)](http://ipn.io)
[![](https://img.shields.io/badge/project-IPFS-blue.svg?style=flat-square)](http://ipfs.io/)
[![](https://img.shields.io/badge/freenode-%23ipfs-blue.svg?style=flat-square)](http://webchat.freenode.net/?channels=%23ipfs)
[![Coverage Status](https://codecov.io/gh/ipfs/go-unixfs/branch/master/graph/badge.svg)](https://codecov.io/gh/ipfs/go-unixfs/branch/master)
[![Travis CI](https://travis-ci.org/ipfs/go-unixfs.svg?branch=master)](https://travis-ci.org/ipfs/go-unixfs)
Jorropo marked this conversation as resolved.
Show resolved Hide resolved

> go-unixfs implements unix-like filesystem utilities on top of an ipld merkledag

## Lead Maintainer

[Steven Allen](https://github.com/Stebalien)
Jorropo marked this conversation as resolved.
Show resolved Hide resolved

## Table of Contents

- [Directory](#directory)
- [Install](#install)
- [Contribute](#contribute)
- [License](#license)

## Package Directory
This package contains many subpackages, each of which can be very large on its own.

### Top Level
The top level unixfs package defines the unixfs format datastructures, and some helper methods around it.

### importers
The `importer` subpackage is what you'll use when you want to turn a normal file into a unixfs file.

### io
The `io` subpackage provides helpers for reading files and manipulating directories. The `DagReader` takes a
reference to a unixfs file and returns a file handle that can be read from and seeked through. The `Directory`
interface allows you to easily read items in a directory, add items to a directory, and do lookups.

### mod
The `mod` subpackage implements a `DagModifier` type that can be used to write to an existing unixfs file, or
create a new one. The logic for this is significantly more complicated than for the dagreader, so its a separate
type. (TODO: maybe it still belongs in the `io` subpackage though?)

### hamt
The `hamt` subpackage implements a CHAMP hamt that is used in unixfs directory sharding.

### archive
The `archive` subpackage implements a `tar` importer and exporter. The objects created here are not officially unixfs,
but in the future, this may be integrated more directly.

### test
The `test` subpackage provides several utilities to make testing unixfs related things easier.

## Install

```sh
go get github.com/ipfs/go-unixfs
```
Jorropo marked this conversation as resolved.
Show resolved Hide resolved

## Contribute

PRs are welcome!

Small note: If editing the Readme, please conform to the [standard-readme](https://github.com/RichardLitt/standard-readme) specification.

## License

MIT © Juan Batiz-Benet
Jorropo marked this conversation as resolved.
Show resolved Hide resolved
183 changes: 183 additions & 0 deletions unixfs/ipld-merkledag/file/unixfile.go
Original file line number Diff line number Diff line change
@@ -0,0 +1,183 @@
package unixfile

import (
"context"
"errors"

ft "github.com/ipfs/go-libipfs/unixfs/ipld-merkledag"
uio "github.com/ipfs/go-libipfs/unixfs/ipld-merkledag/io"

ipld "github.com/ipfs/go-ipld-format"
"github.com/ipfs/go-libipfs/files"
dag "github.com/ipfs/go-merkledag"
)

// Number to file to prefetch in directories
// TODO: should we allow setting this via context hint?
const prefetchFiles = 4

type ufsDirectory struct {
ctx context.Context
dserv ipld.DAGService
dir uio.Directory
size int64
}

type ufsIterator struct {
ctx context.Context
files chan *ipld.Link
dserv ipld.DAGService

curName string
curFile files.Node

err error
errCh chan error
}

func (it *ufsIterator) Name() string {
return it.curName
}

func (it *ufsIterator) Node() files.Node {
return it.curFile
}

func (it *ufsIterator) Next() bool {
if it.err != nil {
return false
}

var l *ipld.Link
var ok bool
for !ok {
if it.files == nil && it.errCh == nil {
return false
}
select {
case l, ok = <-it.files:
if !ok {
it.files = nil
}
case err := <-it.errCh:
it.errCh = nil
it.err = err

if err != nil {
return false
}
}
}

it.curFile = nil

nd, err := l.GetNode(it.ctx, it.dserv)
if err != nil {
it.err = err
return false
}

it.curName = l.Name
it.curFile, it.err = NewUnixfsFile(it.ctx, it.dserv, nd)
return it.err == nil
}

func (it *ufsIterator) Err() error {
return it.err
}

func (d *ufsDirectory) Close() error {
return nil
}

func (d *ufsDirectory) Entries() files.DirIterator {
fileCh := make(chan *ipld.Link, prefetchFiles)
errCh := make(chan error, 1)
go func() {
errCh <- d.dir.ForEachLink(d.ctx, func(link *ipld.Link) error {
if d.ctx.Err() != nil {
return d.ctx.Err()
}
select {
case fileCh <- link:
case <-d.ctx.Done():
return d.ctx.Err()
}
return nil
})

close(errCh)
close(fileCh)
}()

return &ufsIterator{
ctx: d.ctx,
files: fileCh,
errCh: errCh,
dserv: d.dserv,
}
}

func (d *ufsDirectory) Size() (int64, error) {
return d.size, nil
}

type ufsFile struct {
uio.DagReader
}

func (f *ufsFile) Size() (int64, error) {
return int64(f.DagReader.Size()), nil
}

func newUnixfsDir(ctx context.Context, dserv ipld.DAGService, nd *dag.ProtoNode) (files.Directory, error) {
dir, err := uio.NewDirectoryFromNode(dserv, nd)
if err != nil {
return nil, err
}

size, err := nd.Size()
if err != nil {
return nil, err
}

return &ufsDirectory{
ctx: ctx,
dserv: dserv,

dir: dir,
size: int64(size),
}, nil
}

func NewUnixfsFile(ctx context.Context, dserv ipld.DAGService, nd ipld.Node) (files.Node, error) {
switch dn := nd.(type) {
case *dag.ProtoNode:
fsn, err := ft.FSNodeFromBytes(dn.Data())
if err != nil {
return nil, err
}
if fsn.IsDir() {
return newUnixfsDir(ctx, dserv, dn)
}
if fsn.Type() == ft.TSymlink {
return files.NewLinkFile(string(fsn.Data()), nil), nil
}

case *dag.RawNode:
default:
return nil, errors.New("unknown node type")
}

dr, err := uio.NewDagReader(ctx, nd, dserv)
if err != nil {
return nil, err
}

return &ufsFile{
DagReader: dr,
}, nil
}

var _ files.Directory = &ufsDirectory{}
var _ files.File = &ufsFile{}
Loading