Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
G
gbs-downloader
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
This is an archived project. Repository and other project resources are read-only.
Show more breadcrumbs
PrivateStorage
gbs-downloader
Commits
10978a9e
Commit
10978a9e
authored
1 year ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
the actual directory downloading function (used by list-dircap example app)
parent
2afdd41b
No related branches found
No related tags found
1 merge request
!8
Add `downloadDirectory` function!
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
src/Tahoe/Download.hs
+26
-0
26 additions, 0 deletions
src/Tahoe/Download.hs
with
26 additions
and
0 deletions
src/Tahoe/Download.hs
+
26
−
0
View file @
10978a9e
...
@@ -229,3 +229,29 @@ downloadShare storageIndex (shareNum, s) = do
...
@@ -229,3 +229,29 @@ downloadShare storageIndex (shareNum, s) = do
let
massaged
=
first
(
ShareDownloadError
.
(
displayException
::
SomeException
->
String
))
shareBytes
let
massaged
=
first
(
ShareDownloadError
.
(
displayException
::
SomeException
->
String
))
shareBytes
print'
"Downloaded it"
print'
"Downloaded it"
pure
(
shareNum
,
LB
.
fromStrict
<$>
massaged
)
pure
(
shareNum
,
LB
.
fromStrict
<$>
massaged
)
{- | Download the data associated with a directory capability and interpret it
as a collection of entries.
-}
downloadDirectory
::
(
MonadIO
m
,
Readable
readCap
,
Verifiable
v
,
Verifier
readCap
~
v
)
=>
-- | Information about the servers from which to consider downloading shares
-- representing the application data.
Map
.
Map
StorageServerID
StorageServerAnnouncement
->
-- | The read capability for the application data.
DirectoryCapability
readCap
->
-- | Get functions for interacting with a server given its URL.
LookupServer
m
->
-- | Either a description of how the recovery failed or the recovered
-- application data.
m
(
Either
DirectoryDownloadError
Directory
)
downloadDirectory
anns
(
DirectoryCapability
cap
)
lookupServer
=
do
bs
<-
download
anns
cap
lookupServer
pure
$
do
bs'
<-
first
UnderlyingDownloadError
bs
first
(
const
DecodingError
)
$
Directory
.
parse
(
LB
.
toStrict
bs'
)
data
DirectoryDownloadError
=
UnderlyingDownloadError
DownloadError
|
DecodingError
deriving
(
Ord
,
Eq
,
Show
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment