Skip to content

Commit

Permalink
fix review comments
Browse files Browse the repository at this point in the history
Signed-off-by: jyjiangkai <jyjiangkai@163.com>
  • Loading branch information
hwjiangkai committed Feb 17, 2023
1 parent aa43694 commit 065aca2
Show file tree
Hide file tree
Showing 3 changed files with 8 additions and 6 deletions.
10 changes: 7 additions & 3 deletions client/pkg/api/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -62,14 +62,18 @@ func Append(ctx context.Context, w BusWriter, events []*ce.Event, opts ...WriteO
}, opts...)
}

func AppendOne(ctx context.Context, w BusWriter, event *ce.Event, opts ...WriteOption) (eids []string, err error) {
func AppendOne(ctx context.Context, w BusWriter, event *ce.Event, opts ...WriteOption) (eid string, err error) {
eventpb, err := codec.ToProto(event)
if err != nil {
return nil, err
return "", err
}
return w.Append(ctx, &cloudevents.CloudEventBatch{
eids, err := w.Append(ctx, &cloudevents.CloudEventBatch{
Events: []*cloudevents.CloudEvent{eventpb},
}, opts...)
if err != nil {
return "", err
}
return eids[0], nil
}

func Read(ctx context.Context, r BusReader, opts ...ReadOption) (events []*ce.Event, off int64, logid uint64, err error) {
Expand Down
2 changes: 1 addition & 1 deletion client/pkg/eventlog/log_segment.go
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,7 @@ func (s *segment) Append(ctx context.Context, event *cloudevents.CloudEventBatch
return nil, err
}
for idx := range offs {
offs[idx] = offs[idx] + s.startOffset
offs[idx] += s.startOffset
}
return offs, nil
}
Expand Down
2 changes: 0 additions & 2 deletions client/pkg/eventlog/lookup.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,8 +19,6 @@ import (
"context"
"time"

// first-party libraries

// this project
"github.com/linkall-labs/vanus/client/pkg/primitive"
"github.com/linkall-labs/vanus/client/pkg/record"
Expand Down

0 comments on commit 065aca2

Please sign in to comment.