// New returns a new shim service that can be used via GRPC
New returns a new shim service that can be used via GRPC
// New returns a new shim service that can be used via GRPC
func New(ctx context.Context, id string, publisher events.Publisher) (cdshim.Shim, error) {
	logger := logrus.WithField("ID", id)
	logrus.SetOutput(ioutil.Discard)
	opts := ctx.Value(cdshim.OptsKey{}).(cdshim.Opts)
	if !opts.Debug {
		logrus.SetLevel(logrus.WarnLevel)
	}
	vci.SetLogger(ctx, logger)
	katautils.SetLogger(ctx, logger, logger.Logger.Level)
	ctx, cancel := context.WithCancel(ctx)
	s := &service{
		id:         id,
		pid:        uint32(os.Getpid()),
		ctx:        ctx,
		containers: make(map[string]*container),
		events:     make(chan interface{}, chSize),
		ec:         make(chan exit, bufferSize),
		cancel:     cancel,
	}
	go s.processExits()
	go s.forward(publisher)
	return s, nil
}
func New ( ctx context . Context , id string , publisher events . Publisher ) ( cdshim . Shim , error ) { logger := logrus . WithField ( " " , id ) logrus . SetOutput ( ioutil . Discard ) opts := ctx . Value ( cdshim . OptsKey { } ) . ( cdshim . Opts ) if ! opts . Debug { logrus . SetLevel ( logrus . WarnLevel ) } vci . SetLogger ( ctx , logger ) katautils . SetLogger ( ctx , logger , logger . Logger . Level ) ctx , cancel := context . WithCancel ( ctx ) s := & service { id : id , pid : uint32 ( os . Getpid ( ) ) , ctx : ctx , containers : make ( map [ string ] * container ) , events : make ( chan interface { } , chSize ) , ec : make ( chan exit , bufferSize ) , cancel : cancel , } go s . processExits ( ) go s . forward ( publisher ) return s , nil }
New returns a new shim service that can be used via GRPC
New returns a new shim service that can be used via GRPC
// Discard the log before shim init its log output. Otherwise // it will output into stdio, from which containerd would like // to get the shim's socket address.