From 02c77b433ae4a1c4dc88362835e3c6d0e3e0c73e Mon Sep 17 00:00:00 2001 From: Jorropo Date: Mon, 15 Jan 2024 12:42:32 +0100 Subject: [PATCH 1/2] blockservice: fix symbol name in docs --- blockservice/blockservice.go | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/blockservice/blockservice.go b/blockservice/blockservice.go index 72ca44b84..7733788ec 100644 --- a/blockservice/blockservice.go +++ b/blockservice/blockservice.go @@ -494,7 +494,7 @@ func ContextWithSession(ctx context.Context, bs BlockService) context.Context { return EmbedSessionInContext(ctx, newSession(ctx, bs)) } -// EmbedSessionInContext is like [NewSessionContext] but it allows to embed an existing session. +// EmbedSessionInContext is like [ContextWithSession] but it allows to embed an existing session. func EmbedSessionInContext(ctx context.Context, ses *Session) context.Context { // use ses.bs as a key, so if multiple blockservices use embeded sessions it gets dispatched to the matching blockservice. return context.WithValue(ctx, ses.bs, ses) From b8ac21b0a97fc02b583a43b819a41ffdc51b2d72 Mon Sep 17 00:00:00 2001 From: Jorropo Date: Mon, 15 Jan 2024 12:49:56 +0100 Subject: [PATCH 2/2] blockservice: stop using deprecated NewWriteThrough in tests --- blockservice/blockservice_test.go | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/blockservice/blockservice_test.go b/blockservice/blockservice_test.go index 6591529d2..53fd725f3 100644 --- a/blockservice/blockservice_test.go +++ b/blockservice/blockservice_test.go @@ -27,7 +27,7 @@ func TestWriteThroughWorks(t *testing.T) { } exchbstore := blockstore.NewBlockstore(dssync.MutexWrap(ds.NewMapDatastore())) exch := offline.Exchange(exchbstore) - bserv := NewWriteThrough(bstore, exch) + bserv := New(bstore, exch, WriteThrough()) bgen := butil.NewBlockGenerator() block := bgen.Next() @@ -62,7 +62,7 @@ func TestExchangeWrite(t *testing.T) { offline.Exchange(exchbstore), 0, } - bserv := NewWriteThrough(bstore, exch) + bserv := New(bstore, exch, WriteThrough()) bgen := butil.NewBlockGenerator() for name, fetcher := range map[string]BlockGetter{ @@ -136,7 +136,7 @@ func TestLazySessionInitialization(t *testing.T) { session := offline.Exchange(bstore2) exch := offline.Exchange(bstore3) sessionExch := &fakeSessionExchange{Interface: exch, session: session} - bservSessEx := NewWriteThrough(bstore, sessionExch) + bservSessEx := New(bstore, sessionExch, WriteThrough()) bgen := butil.NewBlockGenerator() block := bgen.Next() @@ -234,7 +234,7 @@ func TestNilExchange(t *testing.T) { block := bgen.Next() bs := blockstore.NewBlockstore(dssync.MutexWrap(ds.NewMapDatastore())) - bserv := NewWriteThrough(bs, nil) + bserv := New(bs, nil, WriteThrough()) sess := NewSession(ctx, bserv) _, err := sess.GetBlock(ctx, block.Cid()) if !ipld.IsNotFound(err) {