From 50c8426f1b6a66212d9b8ebfe7f04625ecbd27f7 Mon Sep 17 00:00:00 2001 From: Hector Sanjuan Date: Tue, 16 Mar 2021 16:38:32 +0100 Subject: [PATCH] Remove InitializeKeyspace function from publisher This is mostly go-ipfs specific and has been moved there. See https://github.com/ipfs/go-ipfs/pull/7984 This commit was moved from ipfs/go-namesys@67510bf0749928fd3ca618418c76d67f5ff8e6dd --- namesys/publisher.go | 23 ----------------------- 1 file changed, 23 deletions(-) diff --git a/namesys/publisher.go b/namesys/publisher.go index e2f9e67d8..37dab0ed2 100644 --- a/namesys/publisher.go +++ b/namesys/publisher.go @@ -9,11 +9,9 @@ import ( proto "github.com/gogo/protobuf/proto" ds "github.com/ipfs/go-datastore" dsquery "github.com/ipfs/go-datastore/query" - pin "github.com/ipfs/go-ipfs-pinner" ipns "github.com/ipfs/go-ipns" pb "github.com/ipfs/go-ipns/pb" path "github.com/ipfs/go-path" - ft "github.com/ipfs/go-unixfs" ci "github.com/libp2p/go-libp2p-core/crypto" peer "github.com/libp2p/go-libp2p-core/peer" routing "github.com/libp2p/go-libp2p-core/routing" @@ -294,27 +292,6 @@ func PublishEntry(ctx context.Context, r routing.ValueStore, ipnskey string, rec return r.PutValue(ctx, ipnskey, data) } -// InitializeKeyspace sets the ipns record for the given key to -// point to an empty directory. -// TODO: this doesnt feel like it belongs here -func InitializeKeyspace(ctx context.Context, pub Publisher, pins pin.Pinner, key ci.PrivKey) error { - emptyDir := ft.EmptyDirNode() - - // pin recursively because this might already be pinned - // and doing a direct pin would throw an error in that case - err := pins.Pin(ctx, emptyDir, true) - if err != nil { - return err - } - - err = pins.Flush(ctx) - if err != nil { - return err - } - - return pub.Publish(ctx, key, path.FromCid(emptyDir.Cid())) -} - // PkKeyForID returns the public key routing key for the given peer ID. func PkKeyForID(id peer.ID) string { return "/pk/" + string(id)