dweb-mirror icon indicating copy to clipboard operation
dweb-mirror copied to clipboard

Plugin for seeding

Open mitra42 opened this issue 6 years ago • 3 comments

The idea here is to have an easy API to write plugins to seed to other services (EDITED to reflect Issue diverged onto seed rather than import)

mitra42 avatar Apr 09 '19 11:04 mitra42

Note see #114 as the plugin could maybe handle that as well.

mitra42 avatar Apr 09 '19 11:04 mitra42

###Design thinking ...

DM.Config:

No changes currently - but might be required (note assumed needed urlUrlstore, but if using Transports then will go to API or JS-IPFS automatically) Any changes to config will automatically be passed to Transports assuming located correctly.

DM.seed()

Assemble and pass on reqd parameters to Transports.seed. urlToFile based on (this.httpServer + ACUtil.gateway.urlDownload, relFilePath)

Can call other non-transports seeders with same UI (e.g. NetFreedom / CENO2)

Transports.seed({directoryPath, fileRelativePath, ipfsHash, urlToFile})

As for other functions, ask Transports if they support this seed, and call them with all the optional parameters.

TransportIPFS.seed({urlToFile, ipfsHash})

Future could implement adding directoryPath/fileRelativePath if urlToFile not present Checks ipfsHash matches and reports (but not an error) if doesnt

TransportWebTorrent.seed({directoryPath, fileRelativePath})

Adds the directory, but doesn't try and fetch it, will just seed files that are in the directory. This might need the torrentFileRelativePath.

TransportWolk(dont know)

TransportGun - not supported, don't think it makes sense to seed a file to Gun,

Parameters - mean same in whichever function.

ipfsHash:
When passed as a parameter, its checked against whatever IPFS calculates. Its reported, but not an error if it doesn't match. (the cases are complex, for example the file might have been updated).

urlFile: The URL where that file is available, this is to enable transports (e.g. IPFS) that just map an internal id to a URL.

directoryPath: Absolute path to the directory, for transports that think in terms of directories (e.g. WebTorrent) this is the unit corresponding to a torrent, and should be where the torrent file will be found or should be built

fileRelativePath: Path (relative to directoryPath) to the file to be seeded.

might need torrentFileRelativePath

mitra42 avatar Apr 13 '19 04:04 mitra42

In dweb-transports v0.1.40 and dweb-mirror v0.2.13

mitra42 avatar Apr 14 '19 21:04 mitra42