Code Monkey home page Code Monkey logo

go's Introduction

go's People

Contributors

arianvp avatar baude avatar cristaloleg avatar erincandescent avatar haraldh avatar johanbrandhorst avatar kaysievers avatar shaneing avatar varlink-travis avatar vrothberg avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

go's Issues

Add go.mod file

It would be good to have a go.mod file so that dependants of this repo can resolve transitive dependencies correctly. Even for packages that only use the standard library this is a best practice.

Master not building on windows bridge_windows.go

errormessage:
varlinkbridge_windows.go:47:9: cannot use PipeCon literal (type PipeCon) as type *ctxio.Conn in assignment
varlink\bridge_windows.go:49:3: c.Reader undefined (type Connection has no field or method Reader)
varlink\[email protected]\varlink\bridge_windows.go:50:3: c.Writer undefined (type Connection has no field or method Writer)

i changed it the same code in bridge.c

Adding import
"github.com/varlink/go/varlink/internal/ctxio"
change line 48-1:
c.conn = ctxio.NewConn(PipeCon{nil, cmd, &r, &w})
remove lines:
//c.Reader = bufio.NewReader(r)
//c.Writer = bufio.NewWriter(w)

Is this correct ?

diff --git "a/varlink/bridge_windows.go" "b/varlink/bridge_windows.go"
index 42953b8..26ec6b2 100644
--- "a/varlink/bridge_windows.go"
+++ "b/varlink/bridge_windows.go"
@@ -1,11 +1,12 @@
 package varlink
 
 import (
-	"bufio"
 	"io"
 	"net"
 	"os"
 	"os/exec"
+
+	"github.com/varlink/go/varlink/internal/ctxio" 
 )
 
 type PipeCon struct {
@@ -44,10 +45,8 @@ func NewBridgeWithStderr(bridge string, stderr io.Writer) (*Connection, error) {
 	if err != nil {
 		return nil, err
 	}
-	c.conn = PipeCon{nil, cmd, &r, &w}
+	c.conn = ctxio.NewConn(PipeCon{nil, cmd, &r, &w})
 	c.address = ""
-	c.Reader = bufio.NewReader(r)
-	c.Writer = bufio.NewWriter(w)
 
 	err = cmd.Start()
 	if err != nil { 

getting started documentation would be nice

there isn't anything on the main site or any of the repositories that i'm seeing on how to go from a varlink file to a go package. (I'm assuming a code generator is used...)

Can not parse Systemd's varlink definitions

I am not sure if this is a bug in your implementation or systemd not implementing the spec correctly

But systemd defines a varlink interface here:

https://systemd.io/USER_GROUP_API/

But this library fails to parse it with the following error:

Error parsing file 'io.systemd.UserDatabase.varlink': unknown keyword ''

Trial and error seems to suggest this library is choking over the fact that UserDatabase is capitalized in the interface name. Are interface definitions not allowed to have capital letters in them? Or is this a bug in this library?

interface io.systemd.UserDatabase

method GetUserRecord(
        uid : ?int,
        userName : ?string,
        service : string
) -> (
        record : object,
        incomplete : bool
)

method GetGroupRecord(
        gid : ?int,
        groupName : ?string,
        service : string
) -> (
        record : object,
        incomplete : bool
)

method GetMemberships(
        userName : ?string,
        groupName : ?string,
        service : string
) -> (
        userName : string,
        groupName : string
)

error NoRecordFound()
error BadService()
error ServiceNotAvailable()
error ConflictingRecordFound()
error EnumerationNotSupported()

How do you wait for events as shown in the docs?

How do you wait for events as shown in the docs? I can't see anything that take a context, so I'm assuming it's missing or built incorrectly? Eg from the FAQ:

How can I monitor changes or subscribe to signals?
Varlink connections can be turned into monitor connections, they are soft-negotiated between the client and the service. The client asks the server to possibly reply with more than one reply, the server replies and indicates that it might have more replies and the client should wait for them.

How do I do this in golang?

Additionally, you might want to change this type of interface:

https://godoc.org/github.com/varlink/go/varlink#Connection.Call

func (c *Connection) Call(method string, parameters interface{}, out_parameters interface{}) error

To something that takes a number of functions that return a param. Eg:

func (c *Connection) Call(method string, in []Param, out []Param) error

func BoolParam(value bool) Param
func IntParam(value bool) Param
func WhateverParam(value bool) Param

HTH

How does a "upgraded" connection work?

I want to consume the podman interface through varlink. Specifically, I'm looking to use ExecContainer().
This method requires an "upgraded" connection

So I add the Upgrade flag to the Send()[1], but how will I get the content?

The call immediately returns an empty reply, and later, if I keep reading using the receive function I got from Send(), I'll get the output of the command I Exec-uted.

But I can't find in the doc how I'm supposed to know when and how much should I read, neither the format of the next replies (they don't seem JSON)

+++

[1] I'm experimenting with a patched version of go-varlink-cmd

Expose upgraded connection

The recent change to use a context in all calls also took the liberty of hiding access to the Reader and Writers of the raw connection. Turns out this is sometimes necessary when using the varlink connection, for upgraded connections. See https://github.com/containers/libpod/blob/b713e5371fa8767067bd2c329a3744ea593b2ade/pkg/adapter/runtime_remote.go#L550 for example.

I propose adding a helper that does the first half of that function all in one and return a Reader and Writer from the function.

I intend to prototype this.

Generated errors' error strings should include more metadata

The generated errors error string currently only includes the type name, which is very annoying to handle in applications and for debugging unexpected errors. I propose we add more metadata to the error strings, for example adding the fields of the error to the string.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.