Giter Club home page Giter Club logo

Comments (5)

vaastav avatar vaastav commented on August 16, 2024

Can you show me what your RPC call looks like?

I am interested to see what the API is. Because when I put the interface inside another struct it works completely fine for me.

from govector.

dtrailin avatar dtrailin commented on August 16, 2024

Sure,

This is the send call

		err = connection.Call("MinerApi.FloodOperation", operation, &reply)

And this is the API signature

type MinerApi int

func (m* MinerApi) FloodOperation(args Operation, reply *bool) error {
...
}

If replace Operation with the scruct that implements the interface itself, such as AppendOperation it works.

from govector.

vaastav avatar vaastav commented on August 16, 2024

You are running into the issue where gob can not encode/decode the interface.

A simple fix for this is to embed the operation inside an Args struct

type Args struct {
op Operation
}

and modify your RPC call to have the argument be args *Args instead of op Operation.

That is the best short term fix I can suggest.
I will look into a more permanent solution in the meanwhile. Although I first one to ensure that this is different than normal RPC behaviour.

from govector.

vaastav avatar vaastav commented on August 16, 2024

I just tested it out. Even with Go's RPC package you can not use an interface as your type for Args in your RPC API. You would get the following error :

gob: local interface type *main.Operation can only be decoded from remote interface type; received concrete type AppendOperation

from govector.

bestchai avatar bestchai commented on August 16, 2024

@vaastav can you add information about this to the README (under best practices or common problems)? I'm closing this issue since this is not a GoVector issue.

from govector.

Related Issues (20)

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.