Skip to content

Commit

Permalink
remove zson.Context (#3127)
Browse files Browse the repository at this point in the history
zed.Context replaces it.
  • Loading branch information
nwt authored Sep 29, 2021
1 parent 5407d33 commit df490e3
Show file tree
Hide file tree
Showing 160 changed files with 453 additions and 522 deletions.
3 changes: 1 addition & 2 deletions api/queryio/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/brimdata/zed/driver"
"github.com/brimdata/zed/zbuf"
"github.com/brimdata/zed/zio/zngio"
"github.com/brimdata/zed/zson"
)

func RunClientResponse(ctx context.Context, d driver.Driver, res *client.Response) (zbuf.ScannerStats, error) {
Expand All @@ -23,7 +22,7 @@ func RunClientResponse(ctx context.Context, d driver.Driver, res *client.Respons
return zbuf.ScannerStats{}, fmt.Errorf("unsupported format: %s", format)
}
run := &runner{driver: d}
r := NewZNGReader(zngio.NewReader(res.Body, zson.NewContext()))
r := NewZNGReader(zngio.NewReader(res.Body, zed.NewContext()))
for ctx.Err() == nil {
rec, ctrl, err := r.ReadPayload()
if err != nil {
Expand Down
2 changes: 1 addition & 1 deletion api/queryio/zjson_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ import (
)

func mkRecord(t *testing.T, s string) *zed.Record {
r := zson.NewReader(strings.NewReader(s), zson.NewContext())
r := zson.NewReader(strings.NewReader(s), zed.NewContext())
rec, err := r.Read()
require.NoError(t, err)
return rec
Expand Down
2 changes: 1 addition & 1 deletion api/queryio/zng.go
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,7 @@ func (r *ZNGReader) ReadPayload() (*zed.Record, interface{}, error) {
if msg.Encoding != zed.AppEncodingZSON {
return nil, nil, fmt.Errorf("unsupported app encoding: %v", msg.Encoding)
}
value, err := zson.ParseValue(zson.NewContext(), string(msg.Bytes))
value, err := zson.ParseValue(zed.NewContext(), string(msg.Bytes))
if err != nil {
return nil, nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions builder_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ func TestBuilder(t *testing.T) {
{a:7,r:{x:3}}
{a:7,r:null (0=({x:int64}))}
`
r := zson.NewReader(strings.NewReader(input), zson.NewContext())
r := zson.NewReader(strings.NewReader(input), zed.NewContext())
r0, err := r.Read()
require.NoError(t, err)
r1, err := r.Read()
Expand All @@ -29,7 +29,7 @@ func TestBuilder(t *testing.T) {
r3, err := r.Read()
require.NoError(t, err)

zctx := zson.NewContext()
zctx := zed.NewContext()

t0, err := zctx.LookupTypeRecord([]zed.Column{
{"key", zed.TypeIP},
Expand Down
6 changes: 3 additions & 3 deletions cli/adaptor.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@ import (
"fmt"
"io"

"github.com/brimdata/zed"
"github.com/brimdata/zed/compiler/ast/dag"
"github.com/brimdata/zed/expr/extent"
"github.com/brimdata/zed/order"
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/proc"
"github.com/brimdata/zed/zbuf"
"github.com/brimdata/zed/zio/anyio"
"github.com/brimdata/zed/zson"
"github.com/segmentio/ksuid"
)

Expand Down Expand Up @@ -41,11 +41,11 @@ func (*FileAdaptor) Layout(context.Context, dag.Source) order.Layout {
return order.Nil
}

func (*FileAdaptor) NewScheduler(context.Context, *zson.Context, dag.Source, extent.Span, zbuf.Filter) (proc.Scheduler, error) {
func (*FileAdaptor) NewScheduler(context.Context, *zed.Context, dag.Source, extent.Span, zbuf.Filter) (proc.Scheduler, error) {
return nil, errors.New("pool scan not available when running on local file system")
}

func (f *FileAdaptor) Open(ctx context.Context, zctx *zson.Context, path string, pushdown zbuf.Filter) (zbuf.PullerCloser, error) {
func (f *FileAdaptor) Open(ctx context.Context, zctx *zed.Context, path string, pushdown zbuf.Filter) (zbuf.PullerCloser, error) {
if path == "-" {
path = "stdio:stdin"
}
Expand Down
4 changes: 2 additions & 2 deletions cli/inputflags/flags.go
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@ import (
"fmt"
"os"

"github.com/brimdata/zed"
"github.com/brimdata/zed/cli/auto"
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/zio"
"github.com/brimdata/zed/zio/anyio"
"github.com/brimdata/zed/zio/zngio"
"github.com/brimdata/zed/zson"
)

type Flags struct {
Expand Down Expand Up @@ -47,7 +47,7 @@ func (f *Flags) Init() error {
return nil
}

func (f *Flags) Open(ctx context.Context, zctx *zson.Context, engine storage.Engine, paths []string, stopOnErr bool) ([]zio.Reader, error) {
func (f *Flags) Open(ctx context.Context, zctx *zed.Context, engine storage.Engine, paths []string, stopOnErr bool) ([]zio.Reader, error) {
var readers []zio.Reader
for _, path := range paths {
if path == "-" {
Expand Down
4 changes: 2 additions & 2 deletions cmd/zed/index/convert/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"flag"

"github.com/brimdata/zed"
"github.com/brimdata/zed/cli/inputflags"
zedindex "github.com/brimdata/zed/cmd/zed/index"
"github.com/brimdata/zed/field"
Expand All @@ -13,7 +14,6 @@ import (
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/zio"
"github.com/brimdata/zed/zio/anyio"
"github.com/brimdata/zed/zson"
)

var Convert = &charm.Spec{
Expand Down Expand Up @@ -73,7 +73,7 @@ func (c *Command) Run(args []string) error {
if path == "-" {
path = "stdio:stdin"
}
zctx := zson.NewContext()
zctx := zed.NewContext()
local := storage.NewLocalEngine()
file, err := anyio.Open(ctx, zctx, local, path, c.inputFlags.Options())
if err != nil {
Expand Down
6 changes: 3 additions & 3 deletions cmd/zed/index/create/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import (
"errors"
"flag"

"github.com/brimdata/zed"
"github.com/brimdata/zed/cli/inputflags"
zedindex "github.com/brimdata/zed/cmd/zed/index"
"github.com/brimdata/zed/expr"
Expand All @@ -13,7 +14,6 @@ import (
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/zio"
"github.com/brimdata/zed/zio/anyio"
"github.com/brimdata/zed/zson"
)

var Create = &charm.Spec{
Expand Down Expand Up @@ -73,7 +73,7 @@ func (c *Command) Run(args []string) error {
if path == "-" {
path = "stdio:stdin"
}
zctx := zson.NewContext()
zctx := zed.NewContext()
local := storage.NewLocalEngine()
file, err := anyio.Open(ctx, zctx, local, path, c.inputFlags.Options())
if err != nil {
Expand All @@ -100,7 +100,7 @@ func (c *Command) Run(args []string) error {
return writer.Close()
}

func (c *Command) buildTable(zctx *zson.Context, reader zio.Reader) (*index.MemTable, error) {
func (c *Command) buildTable(zctx *zed.Context, reader zio.Reader) (*index.MemTable, error) {
readKey := expr.NewDotExpr(field.Dotted(c.keyField))
table := index.NewMemTable(zctx)
for {
Expand Down
3 changes: 1 addition & 2 deletions cmd/zed/index/lookup/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ import (
"github.com/brimdata/zed/index"
"github.com/brimdata/zed/pkg/charm"
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/zson"
)

var Lookup = &charm.Spec{
Expand Down Expand Up @@ -67,7 +66,7 @@ func (c *LookupCommand) Run(args []string) error {
return err
}
local := storage.NewLocalEngine()
finder, err := index.NewFinder(ctx, zson.NewContext(), local, uri)
finder, err := index.NewFinder(ctx, zed.NewContext(), local, uri)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/zed/index/section/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"errors"
"flag"

"github.com/brimdata/zed"
"github.com/brimdata/zed/cli/outputflags"
zedindex "github.com/brimdata/zed/cmd/zed/index"
"github.com/brimdata/zed/index"
"github.com/brimdata/zed/pkg/charm"
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/zio"
"github.com/brimdata/zed/zson"
)

var Section = &charm.Spec{
Expand Down Expand Up @@ -57,7 +57,7 @@ func (c *Command) Run(args []string) error {
}
path := args[0]
local := storage.NewLocalEngine()
reader, err := index.NewReader(zson.NewContext(), local, path)
reader, err := index.NewReader(zed.NewContext(), local, path)
if err != nil {
return err
}
Expand Down
2 changes: 1 addition & 1 deletion cmd/zed/lake/find/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -113,7 +113,7 @@ func (c *Command) Run(args []string) error {
hits := make(chan *zed.Record)
var searchErr error
go func() {
searchErr = lake.Find(ctx, zson.NewContext(), lk, query, hits, findOptions...)
searchErr = lake.Find(ctx, zed.NewContext(), lk, query, hits, findOptions...)
close(hits)
}()
for hit := range hits {
Expand Down
3 changes: 2 additions & 1 deletion cmd/zed/lake/index/create.go
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ import (
"flag"
"fmt"

"github.com/brimdata/zed"
"github.com/brimdata/zed/cli/outputflags"
"github.com/brimdata/zed/cli/procflags"
"github.com/brimdata/zed/driver"
Expand Down Expand Up @@ -103,7 +104,7 @@ func parseRule(args []string, ruleName string) ([]string, index.Rule, error) {
if len(args) < 2 {
return nil, nil, errors.New("type index rule requires type argument")
}
typ, err := zson.ParseType(zson.NewContext(), args[1])
typ, err := zson.ParseType(zed.NewContext(), args[1])
if err != nil {
return nil, nil, err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/zed/lake/load/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ import (
"flag"
"fmt"

"github.com/brimdata/zed"
"github.com/brimdata/zed/cli/inputflags"
"github.com/brimdata/zed/cli/lakeflags"
"github.com/brimdata/zed/cli/procflags"
Expand All @@ -16,7 +17,6 @@ import (
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/pkg/units"
"github.com/brimdata/zed/zio"
"github.com/brimdata/zed/zson"
)

var Load = &charm.Spec{
Expand Down Expand Up @@ -76,7 +76,7 @@ func (c *Command) Run(args []string) error {
}
paths := args
local := storage.NewLocalEngine()
readers, err := c.inputFlags.Open(ctx, zson.NewContext(), local, paths, false)
readers, err := c.inputFlags.Open(ctx, zed.NewContext(), local, paths, false)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/zed/query/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ import (
"strings"
"text/tabwriter"

"github.com/brimdata/zed"
"github.com/brimdata/zed/cli"
"github.com/brimdata/zed/cli/inputflags"
"github.com/brimdata/zed/cli/outputflags"
Expand All @@ -21,7 +22,6 @@ import (
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/zbuf"
"github.com/brimdata/zed/zio"
"github.com/brimdata/zed/zson"
)

var Cmd = &charm.Spec{
Expand Down Expand Up @@ -141,7 +141,7 @@ func (c *Command) Run(args []string) error {
if _, err := rlimit.RaiseOpenFilesLimit(); err != nil {
return err
}
zctx := zson.NewContext()
zctx := zed.NewContext()
local := storage.NewLocalEngine()
readers, err := c.inputFlags.Open(ctx, zctx, local, paths, c.stopErr)
if err != nil {
Expand Down
4 changes: 2 additions & 2 deletions cmd/zed/zst/create/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"errors"
"flag"

"github.com/brimdata/zed"
"github.com/brimdata/zed/cli/inputflags"
"github.com/brimdata/zed/cli/outputflags"
"github.com/brimdata/zed/cmd/zed/zst"
"github.com/brimdata/zed/pkg/charm"
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/zio"
"github.com/brimdata/zed/zson"
)

var Create = &charm.Spec{
Expand Down Expand Up @@ -68,7 +68,7 @@ func (c *Command) Run(args []string) error {
return errors.New("must specify one or more input files")
}
local := storage.NewLocalEngine()
readers, err := c.inputFlags.Open(ctx, zson.NewContext(), local, args, true)
readers, err := c.inputFlags.Open(ctx, zed.NewContext(), local, args, true)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/zed/zst/cut/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -5,12 +5,12 @@ import (
"flag"
"strings"

"github.com/brimdata/zed"
"github.com/brimdata/zed/cli/outputflags"
zstcmd "github.com/brimdata/zed/cmd/zed/zst"
"github.com/brimdata/zed/pkg/charm"
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/zio"
"github.com/brimdata/zed/zson"
"github.com/brimdata/zed/zst"
)

Expand Down Expand Up @@ -66,7 +66,7 @@ func (c *Command) Run(args []string) error {
fields := strings.Split(c.fieldExpr, ".")
path := args[0]
local := storage.NewLocalEngine()
cutter, err := zst.NewCutterFromPath(ctx, zson.NewContext(), local, path, fields)
cutter, err := zst.NewCutterFromPath(ctx, zed.NewContext(), local, path, fields)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/zed/zst/inspect/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,13 @@ import (
"errors"
"flag"

"github.com/brimdata/zed"
"github.com/brimdata/zed/cli/outputflags"
zedzst "github.com/brimdata/zed/cmd/zed/zst"
zstcmd "github.com/brimdata/zed/cmd/zed/zst"
"github.com/brimdata/zed/pkg/charm"
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/zio"
"github.com/brimdata/zed/zson"
"github.com/brimdata/zed/zst"
)

Expand Down Expand Up @@ -60,7 +60,7 @@ func (c *Command) Run(args []string) error {
}
path := args[0]
local := storage.NewLocalEngine()
reader, err := zst.NewReaderFromPath(ctx, zson.NewContext(), local, path)
reader, err := zst.NewReaderFromPath(ctx, zed.NewContext(), local, path)
if err != nil {
return err
}
Expand Down
4 changes: 2 additions & 2 deletions cmd/zed/zst/read/command.go
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,12 @@ import (
"errors"
"flag"

"github.com/brimdata/zed"
"github.com/brimdata/zed/cli/outputflags"
zstcmd "github.com/brimdata/zed/cmd/zed/zst"
"github.com/brimdata/zed/pkg/charm"
"github.com/brimdata/zed/pkg/storage"
"github.com/brimdata/zed/zio"
"github.com/brimdata/zed/zson"
"github.com/brimdata/zed/zst"
)

Expand Down Expand Up @@ -54,7 +54,7 @@ func (c *Command) Run(args []string) error {
}
path := args[0]
local := storage.NewLocalEngine()
reader, err := zst.NewReaderFromPath(ctx, zson.NewContext(), local, path)
reader, err := zst.NewReaderFromPath(ctx, zed.NewContext(), local, path)
if err != nil {
return err
}
Expand Down
Loading

0 comments on commit df490e3

Please sign in to comment.