| 28 | var _ vio.Pusher = (*Split)(nil) |
| 29 | |
| 30 | func NewSplit(ctx context.Context, engine storage.Engine, dir *storage.URI, prefix string, unbuffered bool, opts anyio.WriterOpts) (*Split, error) { |
| 31 | e := sio.Extension(opts.Format) |
| 32 | if e == "" { |
| 33 | return nil, fmt.Errorf("unknown format: %s", opts.Format) |
| 34 | } |
| 35 | if prefix != "" { |
| 36 | prefix = prefix + "-" |
| 37 | } |
| 38 | return &Split{ |
| 39 | ctx: ctx, |
| 40 | dir: dir, |
| 41 | prefix: prefix, |
| 42 | unbuffered: unbuffered, |
| 43 | ext: e, |
| 44 | opts: opts, |
| 45 | writers: make(map[super.Type]vio.PushCloser), |
| 46 | seen: make(map[string]struct{}), |
| 47 | engine: engine, |
| 48 | }, nil |
| 49 | } |
| 50 | |
| 51 | func (s *Split) Push(vec vector.Any) error { |
| 52 | if vec, ok := vec.(*vector.Dynamic); ok { |