Documentation ¶
Index ¶
Examples ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func New ¶
func New(closable bool) (uint32, io.WriteCloser)
New creates a new fifo. Fifo is always closable by the creator, but only closable by accessor if closable is set to true.
Example ¶
package main import ( "fmt" "io" symbols "github.com/taubyte/go-sdk-symbols/i2mv/fifo" "github.com/taubyte/go-sdk/i2mv/fifo" ) var ( writeCloser io.WriteCloser id uint32 ) func main() { // Mocking the calls to the vm for usage in tests and playground symbols.MockNew(1) symbols.MockPush(1) id, writeCloser = fifo.New(true) if id != 1 { fmt.Printf("expected id `1` got `%d`", id) return } n, err := writeCloser.Write([]byte("hello world")) if err != nil { fmt.Printf("writing to fifo failed with: %s\n", err) return } fmt.Println(n) }
Output: 11
Types ¶
type Fifo ¶
type Fifo interface { io.ReadCloser Id() uint32 }
TODO: Move to Interfaces once it is open sourced
func Open ¶
Example ¶
package main import ( "fmt" symbols "github.com/taubyte/go-sdk-symbols/i2mv/fifo" "github.com/taubyte/go-sdk/i2mv/fifo" ) func main() { // Mocking the calls to the vm for usage in tests and playground symbols.MockOpen(2, true) ff, err := fifo.Open(2) if err != nil { fmt.Printf("error opening fifo with: %s\n", err) return } fmt.Println(ff.Id()) }
Output: 2
Click to show internal directories.
Click to hide internal directories.