gbs-downloader-0.1.0.0: A library for downloading data from a Great Black Swamp server
Safe HaskellNone
LanguageHaskell2010

Tahoe.Download.Internal.Client

Description

Functionality related to acting as a client for the Great Black Swamp protocol.

Synopsis

Documentation

https :: String -> Int -> BaseUrl Source #

Make an HTTPS URL.

managerSettingsForService :: Text -> Text -> ManagerSettings Source #

Make an HTTPS manager for the given SPKI hash and swissnum.

The SPKI hash is _not_ used to authenticate the server! See https://whetstone.private.storage/privatestorage/tahoe-great-black-swamp/-/issues/27

newGBSManager :: MonadIO m => [Char] -> String -> m Manager Source #

Make a manager suitable for use with a Great Black Swamp server.

data DownloadError Source #

An unrecoverable problem arose while attempting to download and/or read some application data.

Constructors

NoConfiguredServers

The configuration included no candidate servers from which to download.

NoReachableServers [DiscoverError]

Across all of the configured servers, none were actually connectable.

NotEnoughShares

Across all of the configured servers, fewer than the required number of shares were found. XXX Could split this into the different cases - did not locate enough shares, did not download enough shares, did not verify enough shares

NotEnoughDecodedShares

Across all of the shares that we could download, fewer than the required number could actually be decoded.

ShareDecodingFailed

Enough syntactically valid shares were recovered but they could not be interpreted.

NoServers

An attempt was made to download a share but no servers were given for the download.

ShareDownloadError String

An error occurred during share download.

data DiscoverError Source #

A problem arose while attempting to discover the shares held on a particular server.

Constructors

StorageServerLocationUnknown

An announcement did not include a location for a connection attempt.

StorageServerLocationUnsupported

An announcement included a location we could not interpret.

StorageServerUnreachable LookupError 
StorageServerCommunicationError String 

type LookupServer m = StorageServerAnnouncement -> m (Either LookupError StorageServer) Source #

The type of a function that can produce a concrete StorageServer from that server's announcement.

data LookupError Source #

There was a problem while trying to look up a server from its announcement.

Constructors

URIParseError StorageServerAnnouncement

The server's announced URI was unparseable.

PortParseError String

The port integer in the server's URI was unparseable.

AnnouncementStructureUnmatched

The structure of the server's URI was unparseable.

data DeserializeError Source #

A problem was encountered attempting to deserialize bytes to a structured representation of some value.

type GetShareNumbers = String -> ClientM (CBORSet ShareNumber) Source #

type ReadShare = String -> ShareNumber -> Maybe [ByteRange] -> ClientM ByteString Source #

mkWrapper :: GetShareNumbers -> ReadShare -> Manager -> [Char] -> Int -> StorageServer Source #

Create a StorageServer that will speak Great Black Swamp using the given manager to the server at the given host/port.

makeServer :: MonadIO m => GetShareNumbers -> ReadShare -> URI -> m (Either LookupError StorageServer) Source #

If possible, populate a StorageServer with functions for operating on data on the server at the given URI.