Skip to content

Commit

Permalink
Merge pull request #8 from NikitaSkrynnik/deprecated
Browse files Browse the repository at this point in the history
Remove deprecated APIs from vpphelper.Connection
  • Loading branch information
denis-tingaikin authored Nov 21, 2024
2 parents 171e747 + bf458fb commit 359457e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 25 deletions.
20 changes: 2 additions & 18 deletions connection.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ type connection struct {
// DialContext - Dials vpp and returns a Connection
// DialContext is 'lazy' meaning that if there is no socket yet at filename, we will continue to try
// until there is one or the ctx is canceled.
func DialContext(ctx context.Context, filename string) Connection {
func DialContext(ctx context.Context, filename string) api.Connection {
c := &connection{
ready: make(chan struct{}),
}
Expand Down Expand Up @@ -100,23 +100,7 @@ func (c *connection) Invoke(ctx context.Context, req, reply api.Message) error {
return c.Connection.Invoke(ctx, req, reply)
}

func (c *connection) NewAPIChannel() (api.Channel, error) {
<-c.ready
if c.err != nil {
return nil, c.err
}
return c.Connection.NewAPIChannel()
}

func (c *connection) NewAPIChannelBuffered(reqChanBufSize, replyChanBufSize int) (api.Channel, error) {
<-c.ready
if c.err != nil {
return nil, c.err
}
return c.Connection.NewAPIChannelBuffered(reqChanBufSize, replyChanBufSize)
}

var _ Connection = &connection{}
var _ api.Connection = &connection{}

func waitForSocket(ctx context.Context, filename string) error {
watcher, err := fsnotify.NewWatcher()
Expand Down
8 changes: 1 addition & 7 deletions start.go
Original file line number Diff line number Diff line change
Expand Up @@ -31,15 +31,9 @@ import (
"github.com/edwarnicke/log"
)

// Connection Combination of api.Connection and api.ChannelProvider
type Connection interface {
api.Connection
api.ChannelProvider
}

// StartAndDialContext - starts vpp
// Stdout and Stderr for vpp are set to be log.Entry(ctx).Writer().
func StartAndDialContext(ctx context.Context, opts ...Option) (conn Connection, errCh <-chan error) {
func StartAndDialContext(ctx context.Context, opts ...Option) (conn api.Connection, errCh <-chan error) {
o := &option{
rootDir: DefaultRootDir,
vppConfig: DefaultVPPConfTemplate,
Expand Down

0 comments on commit 359457e

Please sign in to comment.