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 all 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
2 changes: 1 addition & 1 deletion examples/go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ require (
)

require (
github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a // indirect
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 // indirect
github.com/beorn7/perks v1.0.1 // indirect
github.com/cespare/xxhash v1.1.0 // indirect
github.com/cespare/xxhash/v2 v2.1.2 // indirect
Expand Down
5 changes: 3 additions & 2 deletions examples/go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -57,8 +57,9 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a h1:E/8AP5dFtMhl5KPJz66Kt9G0n+7Sn41Fy1wv9/jHOrc=
github.com/alecthomas/units v0.0.0-20210927113745-59d0afb8317a/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
Expand Down Expand Up @@ -379,8 +380,8 @@ github.com/ipfs/go-ipfs-blockstore v1.2.0 h1:n3WTeJ4LdICWs/0VSfjHrlqpPpl6MZ+ySd3
github.com/ipfs/go-ipfs-blockstore v1.2.0/go.mod h1:eh8eTFLiINYNSNawfZOC7HOxNTxpB1PFuA5E1m/7exE=
github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ=
github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk=
github.com/ipfs/go-ipfs-chunker v0.0.1 h1:cHUUxKFQ99pozdahi+uSC/3Y6HeRpi9oTeUHbE27SEw=
github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcBFymgY4rSDLAw=
github.com/ipfs/go-ipfs-chunker v0.0.5 h1:ojCf7HV/m+uS2vhUGWcogIIxiO5ubl5O57Q7NapWLY8=
github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ=
github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
Expand Down
14 changes: 10 additions & 4 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ 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/cespare/xxhash v1.1.0
github.com/crackcomm/go-gitignore v0.0.0-20170627025303-887ab5e44cc3
Expand All @@ -12,20 +13,26 @@ require (
github.com/gogo/protobuf v1.3.2
github.com/google/uuid v1.3.0
github.com/gorilla/mux v1.8.0
github.com/ipfs/go-bitfield v1.0.0
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-detect-race v0.0.1
github.com/ipfs/go-ipfs-blockstore v1.2.0
github.com/ipfs/go-ipfs-blocksutil v0.0.1
github.com/ipfs/go-ipfs-chunker v0.0.5
github.com/ipfs/go-ipfs-delay v0.0.1
github.com/ipfs/go-ipfs-exchange-interface v0.2.0
github.com/ipfs/go-ipfs-exchange-offline v0.3.0
github.com/ipfs/go-ipfs-posinfo v0.0.1
github.com/ipfs/go-ipfs-redirects-file v0.1.1
github.com/ipfs/go-ipfs-routing v0.3.0
github.com/ipfs/go-ipfs-util v0.0.2
github.com/ipfs/go-ipld-format v0.4.0
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/ipfs/go-metrics-interface v0.0.1
github.com/ipfs/go-path v0.3.0
github.com/ipfs/go-peertaskqueue v0.8.0
Expand All @@ -45,12 +52,14 @@ require (
github.com/multiformats/go-multistream v0.3.3
github.com/prometheus/client_golang v1.13.0
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
go.opentelemetry.io/otel v1.7.0
go.opentelemetry.io/otel/trace v1.7.0
go.uber.org/multierr v1.8.0
go.uber.org/zap v1.23.0
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4
golang.org/x/sys v0.0.0-20220811171246-fbc7d0a398ab
)

Expand All @@ -67,13 +76,11 @@ require (
github.com/huin/goupnp v1.0.3 // indirect
github.com/ipfs/bbloom v0.0.4 // indirect
github.com/ipfs/go-block-format v0.1.1 // indirect
github.com/ipfs/go-blockservice v0.5.0 // indirect
github.com/ipfs/go-fetcher v1.6.1 // indirect
github.com/ipfs/go-ipfs-ds-help v1.1.0 // indirect
github.com/ipfs/go-ipfs-pq v0.0.2 // 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-merkledag v0.9.0 // indirect
github.com/ipfs/go-verifcid v0.0.2 // indirect
github.com/ipld/go-codec-dagpb v1.5.0 // indirect
github.com/jackpal/go-nat-pmp v1.0.2 // indirect
Expand Down Expand Up @@ -103,16 +110,15 @@ require (
github.com/prometheus/common v0.37.0 // indirect
github.com/prometheus/procfs v0.8.0 // 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/ucarion/urlpath v0.0.0-20200424170820-7ccc79b76bbb // indirect
github.com/whyrusleeping/cbor-gen v0.0.0-20221220214510-0333c149dec0 // indirect
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f // indirect
go.uber.org/atomic v1.10.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/mod v0.6.0-dev.0.20220419223038-86c51ed26bb4 // indirect
golang.org/x/net v0.0.0-20220920183852-bf014ff85ad5 // indirect
golang.org/x/sync v0.0.0-20220722155255-886fb9371eb4 // indirect
golang.org/x/tools v0.1.12 // indirect
golang.org/x/xerrors v0.0.0-20220907171357-04be3eba64a2 // indirect
google.golang.org/protobuf v1.28.1 // indirect
Expand Down
9 changes: 9 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,8 @@ github.com/alecthomas/template v0.0.0-20190718012654-fb15b899a751/go.mod h1:LOuy
github.com/alecthomas/units v0.0.0-20151022065526-2efee857e7cf/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190717042225-c3de453c63f4/go.mod h1:ybxpYRFXyAe+OPACYpWeL0wqObRcbAqCMya13uyzqw0=
github.com/alecthomas/units v0.0.0-20190924025748-f65c72e2690d/go.mod h1:rBZYJk541a8SKzHPHnH3zbiI+7dagKZ0cgpgrD7Fyho=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137 h1:s6gZFSlWYmbqAuRjVTiNNhvNRfY2Wxp9nhfyel4rklc=
github.com/alecthomas/units v0.0.0-20211218093645-b94a6e3cc137/go.mod h1:OMCwj8VM1Kc9e19TLln2VL61YJF0x1XFtfdL4JdbSyE=
github.com/anmitsu/go-shlex v0.0.0-20161002113705-648efa622239/go.mod h1:2FmKhYUyUczH0OGQWaF5ceTx0UBShxjsH6f8oGKYe2c=
github.com/apache/thrift v0.12.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
github.com/apache/thrift v0.13.0/go.mod h1:cp2SuWMxlEZw2r+iP2GNCdIi4C1qmUzdZFSVb+bacwQ=
Expand Down Expand Up @@ -341,6 +343,8 @@ github.com/influxdata/influxdb1-client v0.0.0-20191209144304-8bf82d3c094d/go.mod
github.com/ipfs/bbloom v0.0.1/go.mod h1:oqo8CVWsJFMOZqTglBG4wydCE4IQA/G2/SEofB0rjUI=
github.com/ipfs/bbloom v0.0.4 h1:Gi+8EGJ2y5qiD5FbsbpX/TMNcJw8gSqr7eyjHa4Fhvs=
github.com/ipfs/bbloom v0.0.4/go.mod h1:cS9YprKXpoZ9lT0n/Mw/a6/aFV6DTjTLYHeA+gyqMG0=
github.com/ipfs/go-bitfield v1.0.0 h1:y/XHm2GEmD9wKngheWNNCNL0pzrWXZwCdQGv1ikXknQ=
github.com/ipfs/go-bitfield v1.0.0/go.mod h1:N/UiujQy+K+ceU1EF5EkVd1TNqevLrCQMIcAEPrdtus=
github.com/ipfs/go-bitswap v0.1.0/go.mod h1:FFJEf18E9izuCqUtHxbWEvq+reg7o4CW5wSAE1wsxj0=
github.com/ipfs/go-bitswap v0.1.2/go.mod h1:qxSWS4NXGs7jQ6zQvoPY3+NmOfHHG47mhkiLzBpJQIs=
github.com/ipfs/go-bitswap v0.5.1/go.mod h1:P+ckC87ri1xFLvk74NlXdP0Kj9RmWAh4+H78sC6Qopo=
Expand Down Expand Up @@ -395,6 +399,8 @@ github.com/ipfs/go-ipfs-blockstore v1.2.0/go.mod h1:eh8eTFLiINYNSNawfZOC7HOxNTxp
github.com/ipfs/go-ipfs-blocksutil v0.0.1 h1:Eh/H4pc1hsvhzsQoMEP3Bke/aW5P5rVM1IWFJMcGIPQ=
github.com/ipfs/go-ipfs-blocksutil v0.0.1/go.mod h1:Yq4M86uIOmxmGPUHv/uI7uKqZNtLb449gwKqXjIsnRk=
github.com/ipfs/go-ipfs-chunker v0.0.1/go.mod h1:tWewYK0we3+rMbOh7pPFGDyypCtvGcBFymgY4rSDLAw=
github.com/ipfs/go-ipfs-chunker v0.0.5 h1:ojCf7HV/m+uS2vhUGWcogIIxiO5ubl5O57Q7NapWLY8=
github.com/ipfs/go-ipfs-chunker v0.0.5/go.mod h1:jhgdF8vxRHycr00k13FM8Y0E+6BoalYeobXmUyTreP8=
github.com/ipfs/go-ipfs-delay v0.0.0-20181109222059-70721b86a9a8/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
github.com/ipfs/go-ipfs-delay v0.0.1 h1:r/UXYyRcddO6thwOnhiznIAiSvxMECGgtv35Xs1IeRQ=
github.com/ipfs/go-ipfs-delay v0.0.1/go.mod h1:8SP1YXK1M1kXuc4KJZINY3TQQ03J2rwBG9QfXmbRPrw=
Expand All @@ -409,7 +415,9 @@ github.com/ipfs/go-ipfs-exchange-interface v0.2.0/go.mod h1:z6+RhJuDQbqKguVyslSO
github.com/ipfs/go-ipfs-exchange-offline v0.0.1/go.mod h1:WhHSFCVYX36H/anEKQboAzpUws3x7UeEGkzQc3iNkM0=
github.com/ipfs/go-ipfs-exchange-offline v0.1.1/go.mod h1:vTiBRIbzSwDD0OWm+i3xeT0mO7jG2cbJYatp3HPk5XY=
github.com/ipfs/go-ipfs-exchange-offline v0.3.0 h1:c/Dg8GDPzixGd0MC8Jh6mjOwU57uYokgWRFidfvEkuA=
github.com/ipfs/go-ipfs-exchange-offline v0.3.0/go.mod h1:MOdJ9DChbb5u37M1IcbrRB02e++Z7521fMxqCNRrz9s=
github.com/ipfs/go-ipfs-files v0.0.3/go.mod h1:INEFm0LL2LWXBhNJ2PMIIb2w45hpXgPjNoE7yA8Y1d4=
github.com/ipfs/go-ipfs-posinfo v0.0.1 h1:Esoxj+1JgSjX0+ylc0hUmJCOv6V2vFoZiETLR6OtpRs=
github.com/ipfs/go-ipfs-posinfo v0.0.1/go.mod h1:SwyeVP+jCwiDu0C313l/8jg6ZxM0qqtlt2a0vILTc1A=
github.com/ipfs/go-ipfs-pq v0.0.1/go.mod h1:LWIqQpqfRG3fNc5XsnIhz/wQ2XXGyugQwls7BgUmUfY=
github.com/ipfs/go-ipfs-pq v0.0.2 h1:e1vOOW6MuOwG2lqxcLA+wEn93i/9laCY8sXAw76jFOY=
Expand Down Expand Up @@ -1071,6 +1079,7 @@ github.com/warpfork/go-wish v0.0.0-20200122115046-b9ea61034e4a/go.mod h1:x6AKhvS
github.com/whyrusleeping/cbor-gen v0.0.0-20200123233031-1cdf64d27158/go.mod h1:Xj/M2wWU+QdTdRbu/L/1dIZY8/Wb2K9pAhtroQuxJJI=
github.com/whyrusleeping/cbor-gen v0.0.0-20221220214510-0333c149dec0 h1:obKzQ1ey5AJg5NKjgtTo/CKwLImVP4ETLRcsmzFJ4Qw=
github.com/whyrusleeping/cbor-gen v0.0.0-20221220214510-0333c149dec0/go.mod h1:fgkXqYy7bV2cFeIEOkVTZS/WjXARfBqSH6Q2qHL33hQ=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f h1:jQa4QT2UP9WYv2nzyawpKMOCl+Z/jW7djv2/J50lj9E=
github.com/whyrusleeping/chunker v0.0.0-20181014151217-fe64bd25879f/go.mod h1:p9UJB6dDgdPgMJZs7UjUOdulKyRr9fqkS+6JKAInPy8=
github.com/whyrusleeping/go-keyspace v0.0.0-20160322163242-5b898ac5add1/go.mod h1:8UvriyWtv5Q5EOgjHaSseUEdkQfvwFv1I/In/O2M9gc=
github.com/whyrusleeping/go-logging v0.0.0-20170515211332-0457bb6b88fc/go.mod h1:bopw91TMyo8J3tvftk8xmU2kPmlrt4nScJQZU2hE5EM=
Expand Down
33 changes: 33 additions & 0 deletions unixfs/ipld-merkledag/README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
go-unixfs
==================

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

## 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.
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