github.com/containers/podman/v4@v4.9.4/libpod/events/nullout.go (about) 1 package events 2 3 import ( 4 "context" 5 "errors" 6 ) 7 8 // EventToNull is an eventer type that does nothing. 9 // It is meant for unit tests only 10 type EventToNull struct{} 11 12 // Write eats the event and always returns nil 13 func (e EventToNull) Write(ee Event) error { 14 return nil 15 } 16 17 // Read does nothing and returns an error. 18 func (e EventToNull) Read(ctx context.Context, options ReadOptions) error { 19 return errors.New("cannot read events with the \"none\" backend") 20 } 21 22 // newNullEventer returns a new null eventer. You should only do this for 23 // the purposes of internal libpod testing. 24 func newNullEventer() Eventer { 25 return EventToNull{} 26 } 27 28 // String returns a string representation of the logger 29 func (e EventToNull) String() string { 30 return "none" 31 }