Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
What's new
10
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Open sidebar
dms3
interface-go-dms3-core
Commits
01bbf29c
Commit
01bbf29c
authored
Feb 01, 2019
by
Łukasz Magiera
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
coreapi: resolve type/size in Unixfs.Ls
License: MIT Signed-off-by:
Łukasz Magiera
<
magik6k@gmail.com
>
parent
72006bfe
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
28 additions
and
3 deletions
+28
-3
options/unixfs.go
options/unixfs.go
+17
-0
unixfs.go
unixfs.go
+11
-3
No files found.
options/unixfs.go
View file @
01bbf29c
...
@@ -44,6 +44,9 @@ type UnixfsAddSettings struct {
...
@@ -44,6 +44,9 @@ type UnixfsAddSettings struct {
type
UnixfsLsSettings
struct
{
type
UnixfsLsSettings
struct
{
Async
bool
Async
bool
ResolveType
bool
ResolveSize
bool
}
}
type
UnixfsAddOption
func
(
*
UnixfsAddSettings
)
error
type
UnixfsAddOption
func
(
*
UnixfsAddSettings
)
error
...
@@ -320,3 +323,17 @@ func (unixfsOpts) Async(async bool) UnixfsLsOption {
...
@@ -320,3 +323,17 @@ func (unixfsOpts) Async(async bool) UnixfsLsOption {
return
nil
return
nil
}
}
}
}
func
(
unixfsOpts
)
ResolveSize
(
resolve
bool
)
UnixfsLsOption
{
return
func
(
settings
*
UnixfsLsSettings
)
error
{
settings
.
ResolveSize
=
resolve
return
nil
}
}
func
(
unixfsOpts
)
ResolveType
(
resolve
bool
)
UnixfsLsOption
{
return
func
(
settings
*
UnixfsLsSettings
)
error
{
settings
.
ResolveSize
=
resolve
return
nil
}
}
\ No newline at end of file
unixfs.go
View file @
01bbf29c
...
@@ -2,10 +2,10 @@ package iface
...
@@ -2,10 +2,10 @@ package iface
import
(
import
(
"context"
"context"
"github.com/ipfs/go-ipfs/core/coreapi/interface/options"
"github.com/ipfs/go-ipfs/core/coreapi/interface/options"
ft
"gx/ipfs/QmQ1JnYpnzkaurjW1yxkQxC2w3K1PorNE1nv1vaP5Le7sq/go-unixfs"
"gx/ipfs/QmQ1JnYpnzkaurjW1yxkQxC2w3K1PorNE1nv1vaP5Le7sq/go-unixfs/pb"
ipld
"gx/ipfs/QmRL22E4paat7ky7vx9MLpR97JHHbFPrg3ytFQw6qp1y1s/go-ipld-format"
"gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files"
"gx/ipfs/QmaXvvAVAQ5ABqM5xtjYmV85xmN5MkWAZsX9H9Fwo4FVXp/go-ipfs-files"
)
)
...
@@ -16,6 +16,14 @@ type AddEvent struct {
...
@@ -16,6 +16,14 @@ type AddEvent struct {
Size
string
`json:",omitempty"`
Size
string
`json:",omitempty"`
}
}
type
LsLink
struct
{
Link
*
ipld
.
Link
Size
uint64
Type
unixfs_pb
.
Data_DataType
Err
error
}
// UnixfsAPI is the basic interface to immutable files in IPFS
// UnixfsAPI is the basic interface to immutable files in IPFS
// NOTE: This API is heavily WIP, things are guaranteed to break frequently
// NOTE: This API is heavily WIP, things are guaranteed to break frequently
type
UnixfsAPI
interface
{
type
UnixfsAPI
interface
{
...
@@ -31,5 +39,5 @@ type UnixfsAPI interface {
...
@@ -31,5 +39,5 @@ type UnixfsAPI interface {
Get
(
context
.
Context
,
Path
)
(
files
.
Node
,
error
)
Get
(
context
.
Context
,
Path
)
(
files
.
Node
,
error
)
// Ls returns the list of links in a directory
// Ls returns the list of links in a directory
Ls
(
context
.
Context
,
Path
,
...
options
.
UnixfsLsOption
)
(
<-
chan
ft
.
Link
Result
,
error
)
Ls
(
context
.
Context
,
Path
,
...
options
.
UnixfsLsOption
)
(
<-
chan
Ls
Link
,
error
)
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment