Skip to content

Commit

Permalink
Use Xid instead of UUID for SubscriptionID (yorkie-team#142)
Browse files Browse the repository at this point in the history
Xid(12bytes) smaller than UUID and it's sortable. It is useful if the
SubscriptionID can be sortable.
  • Loading branch information
hackerwins authored and jeonjonghyeok committed Aug 4, 2022
1 parent b41017a commit 58ceaa0
Show file tree
Hide file tree
Showing 3 changed files with 5 additions and 2 deletions.
1 change: 1 addition & 0 deletions go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ require (
github.com/grpc-ecosystem/go-grpc-middleware v1.0.0
github.com/grpc-ecosystem/go-grpc-prometheus v1.2.0
github.com/prometheus/client_golang v0.9.3
github.com/rs/xid v1.2.1
github.com/spf13/cobra v1.1.1
github.com/stretchr/testify v1.6.2-0.20201103103935-92707c0b2d50
github.com/tidwall/pretty v1.0.0 // indirect
Expand Down
2 changes: 2 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
Expand Up @@ -322,6 +322,8 @@ github.com/quasilyte/regex/syntax v0.0.0-20200407221936-30656e2c4a95/go.mod h1:r
github.com/rogpeppe/fastuuid v0.0.0-20150106093220-6724a57986af/go.mod h1:XWv6SoW27p1b0cqNHllgS5HIMJraePCO15w5zCzIWYg=
github.com/rogpeppe/go-internal v1.3.0/go.mod h1:M8bDsm7K2OlrFYOpmOWEs/qY81heoFRclV5y23lUDJ4=
github.com/rogpeppe/go-internal v1.6.0/go.mod h1:xXDCJY+GAPziupqXw64V24skbSoqbTEfhy4qGm1nDQc=
github.com/rs/xid v1.2.1 h1:mhH9Nq+C1fY2l1XIpgxIiUOfNpRBYH1kKcr+qfKgjRc=
github.com/rs/xid v1.2.1/go.mod h1:+uKXf+4Djp6Md1KODXJxgGQPKngRmWyn10oCKFzNHOQ=
github.com/russross/blackfriday/v2 v2.0.1/go.mod h1:+Rmxgy9KzJVeS9/2gXHxylqXiyQDYRxCVz55jmeOWTM=
github.com/ryancurrah/gomodguard v1.1.0 h1:DWbye9KyMgytn8uYpuHkwf0RHqAYO6Ay/D0TbCpPtVU=
github.com/ryancurrah/gomodguard v1.1.0/go.mod h1:4O8tr7hBODaGE6VIhfJDHcwzh5GUccKSJBU0UMXJFVM=
Expand Down
4 changes: 2 additions & 2 deletions yorkie/backend/pubsub/pubsub.go
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ package pubsub
import (
"errors"

"github.com/google/uuid"
"github.com/rs/xid"

"github.com/yorkie-team/yorkie/pkg/document/time"
"github.com/yorkie-team/yorkie/pkg/types"
Expand Down Expand Up @@ -49,7 +49,7 @@ type Subscription struct {
// NewSubscription creates a new instance of Subscription.
func NewSubscription(subscriber types.Client) *Subscription {
return &Subscription{
id: uuid.New().String(),
id: xid.New().String(),
subscriber: subscriber,
// [Workaround] The channel buffer size below avoids stopping during
// event issuing to the events channel. This bug occurs in the order
Expand Down

0 comments on commit 58ceaa0

Please sign in to comment.