Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Serialization with gob #35

Closed
suntong opened this issue Oct 30, 2016 · 6 comments
Closed

Serialization with gob #35

suntong opened this issue Oct 30, 2016 · 6 comments

Comments

@suntong
Copy link

suntong commented Oct 30, 2016

It is possible to make golang-set work with encoding/gob? gob is the good "go to" for serializing things for internal consumption later.

I've prepare a demo here, currently it is giving out error of:

SaveState failed:gob: type sync.RWMutex has no exported fields

Thanks

@suntong
Copy link
Author

suntong commented Oct 30, 2016

I took a look, the sync.RWMutex is coming from threadsafe.go:

type threadSafeSet struct {
    s threadUnsafeSet
    sync.RWMutex
}

If, I do mean "if", it is impossible to over come such problem, can we solve this gob saving problem with issue #11 at the same time -- strip out a properly named threadunsafe version, that supports gob saving? Thx.

@deckarep deckarep closed this as completed Oct 6, 2019
@suntong
Copy link
Author

suntong commented Oct 8, 2019

Well, they all say that closing issues without any explanation is impolite.

@tiferrei
Copy link

@suntong did you find a solution to this?

@suntong
Copy link
Author

suntong commented Sep 14, 2020

Why ask me @tiferrei ?!
You should really ask @deckarep what he is thinking!

@deckarep
Copy link
Owner

Hi @tiferrei and @suntong,

I have chosen to close this issue to keep the library fairly straightforward and simple with respect to serving the purpose of a simple set-based datastructure.

Trying to support Gob is outside the concern of this implementation because where do you draw the line with how many serialization/deserialization libs are you going to support?

Furthermore whatever works for Gob might not work with Protobufs (or some other method) and the bottom line is that this largely depends on the types that get added to this datastructure and not really the datastructure itself.

Also Gob is not the defacto serialization method in my opinion.

@suntong
Copy link
Author

suntong commented Sep 18, 2020

Oh, thanks for the kind explanation.

Yep, make sense, and I agree with your decision.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

3 participants