diff --git a/client/alias.go b/client/alias.go index bbdb0d764..33cdc60bf 100644 --- a/client/alias.go +++ b/client/alias.go @@ -20,6 +20,10 @@ import ( "github.com/linkall-labs/vanus/client/pkg/eventlog" ) +const ( + XVanusLogOffset = eventlog.XVanusLogOffset +) + // EventBus functions. var ( // OpenBusWriter open a Writer of EventBus identified by vrn. diff --git a/client/internal/vanus/eventlog/log_segment.go b/client/internal/vanus/eventlog/log_segment.go index b1a691cba..2e57db771 100644 --- a/client/internal/vanus/eventlog/log_segment.go +++ b/client/internal/vanus/eventlog/log_segment.go @@ -185,6 +185,7 @@ func (s *logSegment) Read(ctx context.Context, from int64, size int16) ([]*ce.Ev buf := make([]byte, 8) binary.BigEndian.PutUint64(buf, uint64(offset)) e.SetExtension(eventlog.XVanusLogOffset, buf) + e.SetExtension(segment.XVanusBlockOffset, nil) } return events, err diff --git a/internal/store/segment/server_test.go b/internal/store/segment/server_test.go index 80e61c723..0ad03d97d 100644 --- a/internal/store/segment/server_test.go +++ b/internal/store/segment/server_test.go @@ -16,7 +16,6 @@ package segment import ( "context" - stdCtx "context" "fmt" "os" "path" @@ -40,7 +39,7 @@ func TestServer_RemoveBlock(t *testing.T) { Convey("test RemoveBlock", t, func() { cfg := store.Config{} srv := NewServer(cfg).(*server) - ctx := stdCtx.Background() + ctx := context.Background() Convey("test state checking", func() { err := srv.RemoveBlock(ctx, vanus.NewID()) et := err.(*errors.ErrorType) @@ -66,7 +65,7 @@ func TestServer_RemoveBlock(t *testing.T) { }() p := path.Join(dir, "/vanus/test/store/test") _ = os.MkdirAll(p, 0777) - blk, err := file.Create(stdCtx.Background(), p, vanus.NewID(), 1024*1024*64) + blk, err := file.Create(context.Background(), p, vanus.NewID(), 1024*1024*64) So(err, ShouldBeNil) Convey("the block not found", func() {