cqlclient.go ×19

Frontier kind: Code frontier

unlabeled · c_26bd52dad35a

5 tests · 2373 LOC · 113 files · introduces 0 tests · 59 LOC · 2 files

Introduces — evidence that enters the hierarchy at this concept

Code
20 ranges59 lines · 2 files
Tests
0 tests

Contains — complete concept membership

All code (extent)
401 ranges2373 lines · 113 files · Browse complete extent
All tests (intent)
5 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: 59 introduced LOC across 20 ranges. Expand a file to inspect source; the > gutter marks introduced lines.

go.temporal.io/server/tools/cassandra/cqlclient.go 55 introduced LOC · 19 ranges

Open complete file

157 }
158
159 > func (client *cqlClient) DropAllTables() error { cqlclient.go
160 > return client.dropAllTablesTypes()
161 > }
162
163 // CreateSchemaVersionTables sets up the schema version tables
164 > func (client *cqlClient) CreateSchemaVersionTables() error { cqlclient.go
165 > if err := client.Exec(createSchemaVersionTableCQL); err != nil {
166 return err
167 }
168 > return client.Exec(createSchemaUpdateHistoryTableCQL) cqlclient.go
169 }
170
171 // ReadSchemaVersion returns the current schema version for the Keyspace
172 > func (client *cqlClient) ReadSchemaVersion() (string, error) { cqlclient.go
173 > query := client.session.Query(readSchemaVersionCQL, client.keyspace)
174 >
175 > iter := query.Iter()
176 > var version string
177 > success := iter.Scan(&version)
178 > err := iter.Close()
179 > if err == nil && !success {
180 err = fmt.Errorf("no schema version found for keyspace %q", client.keyspace)
181 }
182 > if err != nil { cqlclient.go
183 > return "", fmt.Errorf("unable to get current schema version from Cassandra: %w", err)
184 > }
185 return version, nil
186 }
187
188 // UpdateShemaVersion updates the schema version for the Keyspace
189 > func (client *cqlClient) UpdateSchemaVersion(newVersion string, minCompatibleVersion string) error { cqlclient.go
190 > query := client.session.Query(writeSchemaVersionCQL, client.keyspace, time.Now().UTC(), newVersion, minCompatibleVersion)
191 > return query.Exec()
192 > }
193
194 // WriteSchemaUpdateLog adds an entry to the schema update history table
195 > func (client *cqlClient) WriteSchemaUpdateLog(oldVersion string, newVersion string, manifestMD5 string, desc string) error { cqlclient.go
196 > now := time.Now().UTC()
197 > query := client.session.Query(writeSchemaUpdateHistoryCQL)
198 > query.Bind(now.Year(), int(now.Month()), now, oldVersion, newVersion, manifestMD5, desc)
199 > return query.Exec()
200 > }
201
202 // Exec executes a cql statement
216
217 // ListTables lists the table names in a Keyspace
218 > func (client *cqlClient) ListTables() ([]string, error) { cqlclient.go
219 > query := client.session.Query(listTablesCQL, client.keyspace)
220 > iter := query.Iter()
221 > var names []string
222 > var name string
223 > for iter.Scan(&name) {
224 names = append(names, name)
225 }
226 > if err := iter.Close(); err != nil { cqlclient.go
227 return nil, err
228 }
229 > return names, nil cqlclient.go
230 }
231
232 // listTypes lists the User defined types in a Keyspace
233 > func (client *cqlClient) listTypes() ([]string, error) { cqlclient.go
234 > qry := client.session.Query(listTypesCQL, client.keyspace)
235 > iter := qry.Iter()
236 > var names []string
237 > var name string
238 > for iter.Scan(&name) {
239 names = append(names, name)
240 }
241 > if err := iter.Close(); err != nil { cqlclient.go
242 return nil, err
243 }
244 > return names, nil cqlclient.go
245 }
246
257 // dropAllTablesTypes deletes all tables/types in the
258 // Keyspace without deleting the Keyspace
259 > func (client *cqlClient) dropAllTablesTypes() error { cqlclient.go
260 > tables, err := client.ListTables()
261 > if err != nil {
262 return err
263 }
264 > client.logger.Info(fmt.Sprintf("Dropping following tables: %v.", tables)) cqlclient.go
265 > for _, table := range tables {
266 err1 := client.dropTable(table)
267 if err1 != nil {
270 }
271
272 > types, err := client.listTypes() cqlclient.go
273 > if err != nil {
274 return err
275 }
276 > client.logger.Info(fmt.Sprintf("Dropping following types: %v.", types)) cqlclient.go
277 > numOfTypes := len(types)
278 > for i := 0; i < numOfTypes && len(types) > 0; i++ {
279 var erroredTypes []string
280 for _, t := range types {
287 types = erroredTypes
288 }
289 > if len(types) > 0 { cqlclient.go
290 return err
291 }
292 > return nil cqlclient.go
293 }
294
go.temporal.io/server/common/persistence/nosql/nosqlplugin/cassandra/gocql/query.go 4 introduced LOC · 1 range

Open complete file

97 }
98
99 > func (q *query) Bind(v ...any) Query { query.go
100 > q.gocqlQuery.Bind(v...)
101 > return newQuery(q.session, q.gocqlQuery)
102 > }
103
104 func (q *query) Idempotent(value bool) Query {