| Conditions | 3 |
| Total Lines | 22 |
| Code Lines | 16 |
| Lines | 0 |
| Ratio | 0 % |
| Changes | 0 | ||
| 1 | package memory |
||
| 36 | func (w *SchemaWriter) WriteSchema(_ context.Context, definitions []storage.SchemaDefinition) error { |
||
| 37 | var err error |
||
| 38 | txn := w.database.DB.Txn(true) |
||
| 39 | defer txn.Abort() |
||
| 40 | |||
| 41 | var tenantID string |
||
| 42 | var version string |
||
| 43 | |||
| 44 | for _, definition := range definitions { |
||
| 45 | if err = txn.Insert(constants.SchemaDefinitionsTable, definition); err != nil { |
||
| 46 | return errors.New(base.ErrorCode_ERROR_CODE_EXECUTION.String()) |
||
| 47 | } |
||
| 48 | tenantID = definition.TenantID |
||
| 49 | version = definition.Version |
||
| 50 | } |
||
| 51 | txn.Commit() |
||
| 52 | |||
| 53 | mu.Lock() |
||
| 54 | headVersion[tenantID] = version |
||
| 55 | mu.Unlock() |
||
| 56 | |||
| 57 | return nil |
||
| 58 | } |
||
| 59 |