Giter Site home page Giter Site logo

indigo's People

Contributors

osamingo 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  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

indigo's Issues

generate same id in same node

eg:
dateTmStr := "2017-10-11 16:00:00"
loc, _ := time.LoadLocation("Local")
dateTime, err := time.ParseInLocation("2006-01-02 15:04:05", dateTmStr, loc)

genHandle := indigo.New(nil, indigo.StartTime(dateTime), indigo.MachineID(1))

idStr, err := genHandle .NextID()
// 这idstr会是相同的id
eg:
my log show this( id generation in first time)
2020/03/05 16:45:31.579 [D] [*.go:42] new idstr: J6asGGvR1A
2020/03/05 16:45:31.579 [D] [
.go:40] new global uniq id: J6asGGvR1A

(then generate an other id, log show the same as first one):

2020/03/05 16:45:31.579 [D] [.go:339] new token id: J6asGGvR1A
2020/03/05 16:45:31.579 [D] [
.go:347] new token: J6asGGvR1A

question:
the implementation of unique id generator is not ok, as it produce same id in one node.
its' implementation need to check..

Repeated IDs and multiple instance use case

I am hoping to use this in some code for generating unique max 11 character IDs.

A couple of questions:

i) Can the library be used where different instances of a code, say in a Lambda Functions, need to get a unique ID, or there needs to be a running server, coordinating the IDs?
ii) I tried a small unit test:

g := indigo.New(nil, indigo.StartTime(time.Now()))

id1, err := g.NextID()
if err != nil {
	t.Error("should be nil")
}

fmt.Println(id1)

id2, err := g.NextID()
if err != nil {
	t.Error("should be nil")
}

fmt.Println(id2)

I was getting same values for different executions of the test:

=== RUN TestIndigoID
nvReu8adFt
nvReu8axjp

=== RUN TestIndigoID
nvReu8adFt
nvReu8axjp

Another set of consecutive runs:

=== RUN TestIndigoID
2Uzir
2VLCn

=== RUN TestIndigoID
2Uzir
2VLCn
Does this mean it starts from an initial value whenever there is a call to indigo.New?

Thanks

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.