shard_store.go ×7

Frontier kind: Code frontier

unlabeled · c_7fed922ed21a

103 tests · 3365 LOC · 162 files · introduces 0 tests · 48 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
8 ranges48 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
582 ranges3365 lines · 162 files · Browse complete extent
All tests (intent)
103 testsBrowse complete intent

Neighbourhood graph

The orange circle is the focus. Violet and green circles are every ancestor and descendant, broader and narrower, at any distance; blue squares and pink diamonds are the introduced files and exact introduced tests of every visible concept, not only the focus's. Arrows point from broader to narrower concepts and bridge only concepts omitted from this view. Undirected links show source or test introduction. Concept and file size follows LOC; exact test nodes use test-count units.

Introduced files, introduced tests, and structurally relevant concept specialization

In the embedded map, ordinary wheel input scrolls the page; use the visible controls to zoom and drag to pan. Open the full-screen map for canvas navigation: wheel pans, Ctrl/Command plus wheel zooms, and arrow keys pan when this region is focused. On touch screens, open the full-screen map to pan or pinch. If JavaScript or WebGL is unavailable, use the native relationship evidence on this page.

Graph controls are ready.

Interactive rendering requires JavaScript and WebGL. Use the native relationship evidence on this page while the interactive map is unavailable.

Native relationship evidence

Every exact file and test below is linked only from the concept that introduces it.

Introduced tests

Every collected test enters the hierarchy at exactly one concept.

No tests are introduced at this concept. Its intent tests are introduced by other concepts.

Introduced code

Every collected source range enters the hierarchy at exactly one concept.

2 files ranked by introduced lines: 48 introduced LOC across 8 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/common/persistence/cassandra/shard_store.go 45 introduced LOC · 7 ranges

Open complete file

50 session gocql.Session,
51 logger log.Logger,
52 > ) *ShardStore { shard_store.go
53 > return &ShardStore{
54 > ClusterName: clusterName,
55 > Session: session,
56 > Logger: logger,
57 > }
58 > }
59
60 func (d *ShardStore) GetOrCreateShard(
61 ctx context.Context,
62 request *p.InternalGetOrCreateShardRequest,
63 > ) (*p.InternalGetOrCreateShardResponse, error) { shard_store.go
64 > query := d.Session.Query(templateGetShardQuery,
65 > request.ShardID,
66 > rowTypeShard,
67 > rowTypeShardNamespaceID,
68 > rowTypeShardWorkflowID,
69 > rowTypeShardRunID,
70 > defaultVisibilityTimestamp,
71 > rowTypeShardTaskID,
72 > ).WithContext(ctx)
73 >
74 > var data []byte
75 > var encoding string
76 > err := query.Scan(&data, &encoding)
77 > if err == nil {
78 return &p.InternalGetOrCreateShardResponse{
79 ShardInfo: p.NewDataBlob(data, encoding),
80 }, nil
81 > } else if !gocql.IsNotFoundError(err) || request.CreateShardInfo == nil { shard_store.go
82 return nil, gocql.ConvertError("GetOrCreateShard", err)
83 }
84
85 // shard was not found and we should create it
86 > rangeID, shardInfo, err := request.CreateShardInfo() shard_store.go
87 > if err != nil {
88 return nil, err
89 }
90
91 > query = d.Session.Query(templateCreateShardQuery, shard_store.go
92 > request.ShardID,
93 > rowTypeShard,
94 > rowTypeShardNamespaceID,
95 > rowTypeShardWorkflowID,
96 > rowTypeShardRunID,
97 > defaultVisibilityTimestamp,
98 > rowTypeShardTaskID,
99 > shardInfo.Data,
100 > shardInfo.EncodingType.String(),
101 > rangeID,
102 > ).WithContext(ctx)
103 >
104 > previous := make(map[string]any)
105 > applied, err := query.MapScanCAS(previous)
106 > if err != nil {
107 return nil, gocql.ConvertError("GetOrCreateShard", err)
108 }
109 > if !applied { shard_store.go
110 // conflict, try again
111 request.CreateShardInfo = nil // prevent loop
112 return d.GetOrCreateShard(ctx, request)
113 }
114 > return &p.InternalGetOrCreateShardResponse{ shard_store.go
115 > ShardInfo: shardInfo,
116 > }, nil
117 }
118
go.temporal.io/server/common/persistence/cassandra/factory.go 3 introduced LOC · 1 range

Open complete file

84
85 // NewShardStore returns a new shard store
86 > func (f *Factory) NewShardStore() (p.ShardStore, error) { factory.go
87 > return NewShardStore(f.clusterName, f.session, f.logger), nil
88 > }
89
90 // NewMetadataStore returns a metadata store