Exemplo n.º 1
0
// ArchiveBlockReferences implements the BlockServer interface for
// BlockServerLocal
func (b *BlockServerLocal) ArchiveBlockReferences(ctx context.Context,
	tlfID TlfID, contexts map[BlockID]BlockContext) error {
	for id, context := range contexts {
		refNonce := context.GetRefNonce()
		b.log.CDebugf(ctx, "BlockServerLocal.ArchiveBlockReference id=%s "+
			"refnonce=%s", id, refNonce)
		err := b.s.archiveReference(id, refNonce)
		if err != nil {
			return err
		}
	}

	return nil
}
Exemplo n.º 2
0
// ArchiveBlockReferences implements the BlockServer interface for
// BlockServerRemote
func (b *BlockServerRemote) ArchiveBlockReferences(ctx context.Context,
	tlfID TlfID, contexts map[BlockID]BlockContext) error {
	refs := make([]keybase1.BlockReference, 0, len(contexts))
	for id, context := range contexts {
		refs = append(refs, keybase1.BlockReference{
			Bid: keybase1.BlockIdCombo{
				ChargedTo: context.GetCreator(),
				BlockHash: id.String(),
			},
			ChargedTo: context.GetWriter(),
			Nonce:     keybase1.BlockRefNonce(context.GetRefNonce()),
		})
	}
	return b.archiveBlockReferences(ctx, tlfID, refs)
}