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
go-ds-flatfs
Commits
5717e844
Commit
5717e844
authored
Feb 10, 2020
by
Steven Allen
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
feat(query): use naive query logic
That way, we're finally implementing everything.
parent
0d317171
Changes
1
Show whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
12 additions
and
9 deletions
+12
-9
flatfs.go
flatfs.go
+12
-9
No files found.
flatfs.go
View file @
5717e844
...
...
@@ -660,14 +660,6 @@ func (fs *Datastore) Query(q query.Query) (query.Results, error) {
// the user requests a filter by prefix.
return
query
.
ResultsWithEntries
(
q
,
nil
),
nil
}
if
len
(
q
.
Filters
)
>
0
||
len
(
q
.
Orders
)
>
0
||
q
.
Limit
>
0
||
q
.
Offset
>
0
{
// TODO this is overly simplistic, but the only caller is
// `ipfs refs local` for now, and this gets us moving.
return
nil
,
errors
.
New
(
"flatfs only supports listing all keys in random order"
)
}
// Replicates the logic in ResultsWithChan but actually respects calls
// to `Close`.
...
...
@@ -684,7 +676,18 @@ func (fs *Datastore) Query(q query.Query) (query.Results, error) {
})
go
b
.
Process
.
CloseAfterChildren
()
//nolint
return
b
.
Results
(),
nil
results
:=
b
.
Results
()
if
len
(
q
.
Filters
)
>
0
||
len
(
q
.
Orders
)
>
0
||
q
.
Limit
>
0
||
q
.
Offset
>
0
{
nq
:=
q
nq
.
Prefix
=
""
// already handled
results
=
query
.
NaiveQueryApply
(
nq
,
results
)
}
return
results
,
nil
}
func
(
fs
*
Datastore
)
walkTopLevel
(
path
string
,
result
*
query
.
ResultBuilder
)
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