Add feature to want() missing blobs

This commit is contained in:
Christian Bundy 2019-09-23 08:45:18 -07:00
parent 2c7b4ac130
commit b18fdab014
No known key found for this signature in database
GPG Key ID: EB541AAEF4366237
3 changed files with 9 additions and 2 deletions

View File

@ -12,8 +12,9 @@ module.exports = async function imagePage ({ blobId, imageSize }) {
return new Promise((resolve) => {
pull(
bufferSource,
pull.collect((err, bufferArray) => {
pull.collect(async (err, bufferArray) => {
if (err) {
await blob.want({ blobId })
sharp({
create: {
width: imageSize,

View File

@ -8,5 +8,10 @@ module.exports = {
debug('requested blob: %s', blobId)
const ssb = await cooler.connect()
return cooler.read(ssb.blobs.get, blobId)
},
want: async ({ blobId }) => {
debug('requested blob: %s', blobId)
const ssb = await cooler.connect()
return cooler.get(ssb.blobs.want, blobId)
}
}

View File

@ -12,8 +12,9 @@ const rawConnect = () => new Promise((resolve, reject) => {
manifest: {
about: { socialValue: 'async' },
backlinks: { read: 'source' },
blobs: { get: 'source' },
blobs: { get: 'source', want: 'async' },
createUserStream: 'source',
createHistoryStream: 'source',
get: 'sync',
messagesByType: 'source',
publish: 'async',