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
12062b33
Commit
12062b33
authored
1 year ago
by
Jean-Paul Calderone
Browse files
Options
Downloads
Patches
Plain Diff
Download and list entries in an SDMF directory
parent
1aa0ffc0
Branches
Branches containing commit
Tags
Tags containing commit
1 merge request
!8
Add `downloadDirectory` function!
Changes
3
Hide whitespace changes
Inline
Side-by-side
Showing
3 changed files
gbs-downloader.cabal
+2
-2
2 additions, 2 deletions
gbs-downloader.cabal
list-dircap/Main.hs
+11
-15
11 additions, 15 deletions
list-dircap/Main.hs
src/Tahoe/Download.hs
+3
-0
3 additions, 0 deletions
src/Tahoe/Download.hs
with
16 additions
and
17 deletions
gbs-downloader.cabal
+
2
−
2
View file @
12062b33
...
@@ -111,6 +111,7 @@ library
...
@@ -111,6 +111,7 @@ library
, servant-client
, servant-client
, servant-client-core
, servant-client-core
, tahoe-chk
, tahoe-chk
, tahoe-directory
, tahoe-great-black-swamp >=0.3 && <0.4
, tahoe-great-black-swamp >=0.3 && <0.4
, tahoe-ssk >=0.2 && <0.3
, tahoe-ssk >=0.2 && <0.3
, text
, text
...
@@ -189,14 +190,13 @@ executable list-dircap
...
@@ -189,14 +190,13 @@ executable list-dircap
, gbs-downloader
, gbs-downloader
, megaparsec
, megaparsec
, tahoe-directory
, tahoe-directory
, tahoe-ssk >=0.2 && <0.3
, tahoe-ssk
>=0.2 && <0.3
, text
, text
, yaml
, yaml
hs-source-dirs: list-dircap
hs-source-dirs: list-dircap
default-language: Haskell2010
default-language: Haskell2010
test-suite gbs-downloader-test
test-suite gbs-downloader-test
-- Import common warning flags.
-- Import common warning flags.
import:
import:
...
...
This diff is collapsed.
Click to expand it.
list-dircap/Main.hs
+
11
−
15
View file @
12062b33
...
@@ -3,9 +3,6 @@
...
@@ -3,9 +3,6 @@
module
Main
where
module
Main
where
import
qualified
Data.ByteString
as
B
import
qualified
Data.ByteString
as
B
-- import qualified Data.ByteString.Char8 as C8
-- import qualified Data.ByteString.Lazy as BL
import
qualified
Data.Text
as
T
import
qualified
Data.Text
as
T
import
Data.Yaml
(
decodeEither'
)
import
Data.Yaml
(
decodeEither'
)
import
System.Environment
(
getArgs
)
import
System.Environment
(
getArgs
)
...
@@ -13,25 +10,24 @@ import Tahoe.Announcement (Announcements (..))
...
@@ -13,25 +10,24 @@ import Tahoe.Announcement (Announcements (..))
import
qualified
Tahoe.Directory
as
TD
import
qualified
Tahoe.Directory
as
TD
import
Text.Megaparsec
(
parse
)
import
Text.Megaparsec
(
parse
)
--
import Tahoe.Download (announcementToMutableStorageServer, download)
import
Tahoe.Download
(
announcementToMutableStorageServer
,
download
Directory
)
main
::
IO
()
main
::
IO
()
main
=
do
main
=
do
[
announcementPath
,
dirReadCap
]
<-
getArgs
[
announcementPath
,
dirReadCap
]
<-
getArgs
-- Load server announcements
-- Load server announcements
announcementsBytes
<-
B
.
readFile
announcementPath
announcementsBytes
<-
B
.
readFile
announcementPath
let
Right
(
Announcements
_
announcements
)
=
decodeEither'
announcementsBytes
let
Right
(
Announcements
announcements
)
=
decodeEither'
announcementsBytes
-- Accept & parse read capability
-- Accept & parse read capability
case
parse
TD
.
pReadSDMF
"<argv>"
(
T
.
pack
dirReadCap
)
of
case
parse
TD
.
pReadSDMF
"<argv>"
(
T
.
pack
dirReadCap
)
of
Left
e
->
print
$
"Failed to parse cap: "
<>
show
e
Left
e
->
print
$
"Failed to parse cap: "
<>
show
e
Right
r
->
print
r
Right
r
->
go
announcements
r
where
-- where
go
announcements
cap
=
do
-- go announcements cap = do
-- Download & decode the shares
-- -- Download & decode the shares
result
<-
downloadDirectory
announcements
cap
announcementToMutableStorageServer
-- result <- download announcements cap announcementToMutableStorageServer
-- Show the result
-- -- Show the result
putStrLn
"Your result:"
-- putStrLn "Your result:"
either
print
print
result
-- either print (C8.putStrLn . BL.toStrict) result
This diff is collapsed.
Click to expand it.
src/Tahoe/Download.hs
+
3
−
0
View file @
12062b33
...
@@ -10,6 +10,7 @@ module Tahoe.Download (
...
@@ -10,6 +10,7 @@ module Tahoe.Download (
DiscoverError
(
..
),
DiscoverError
(
..
),
discoverShares
,
discoverShares
,
download
,
download
,
downloadDirectory
,
announcementToImmutableStorageServer
,
announcementToImmutableStorageServer
,
announcementToMutableStorageServer
,
announcementToMutableStorageServer
,
getShareNumbers
,
getShareNumbers
,
...
@@ -28,6 +29,8 @@ import qualified Data.Set as Set
...
@@ -28,6 +29,8 @@ import qualified Data.Set as Set
import
Tahoe.Announcement
(
StorageServerAnnouncement
)
import
Tahoe.Announcement
(
StorageServerAnnouncement
)
import
Tahoe.CHK.Server
(
StorageServer
(
..
),
StorageServerID
)
import
Tahoe.CHK.Server
(
StorageServer
(
..
),
StorageServerID
)
import
Tahoe.CHK.Types
(
ShareNum
,
StorageIndex
)
import
Tahoe.CHK.Types
(
ShareNum
,
StorageIndex
)
import
Tahoe.Directory
(
Directory
,
DirectoryCapability
(
DirectoryCapability
))
import
qualified
Tahoe.Directory
as
Directory
import
Tahoe.Download.Internal.Capability
import
Tahoe.Download.Internal.Capability
import
Tahoe.Download.Internal.Client
import
Tahoe.Download.Internal.Client
import
Tahoe.Download.Internal.Immutable
import
Tahoe.Download.Internal.Immutable
...
...
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