GetTableHash implements the interface doltdb.RootValue.
(ctx context.Context, tName doltdb.TableName)
| 396 | |
| 397 | // GetTableHash implements the interface doltdb.RootValue. |
| 398 | func (root *RootValue) GetTableHash(ctx context.Context, tName doltdb.TableName) (hash.Hash, bool, error) { |
| 399 | // Check the tables first |
| 400 | tableMap, err := root.getTableMap(ctx, tName.Schema) |
| 401 | if err != nil { |
| 402 | return hash.Hash{}, false, err |
| 403 | } |
| 404 | tVal, err := tableMap.Get(ctx, tName.Name) |
| 405 | if err != nil { |
| 406 | return hash.Hash{}, false, err |
| 407 | } |
| 408 | if !tVal.IsEmpty() { |
| 409 | return tVal, true, nil |
| 410 | } |
| 411 | // Then check the root objects |
| 412 | _, rawID, objID, err := rootobject.ResolveName(ctx, root, tName) |
| 413 | if err != nil { |
| 414 | return hash.Hash{}, false, err |
| 415 | } |
| 416 | if objID == objinterface.RootObjectID_None { |
| 417 | return hash.Hash{}, false, nil |
| 418 | } |
| 419 | coll, err := rootobject.LoadCollection(ctx, root, objID) |
| 420 | if err != nil { |
| 421 | return hash.Hash{}, false, err |
| 422 | } |
| 423 | obj, ok, err := coll.GetRootObject(ctx, rawID) |
| 424 | if err != nil || !ok { |
| 425 | return hash.Hash{}, false, err |
| 426 | } |
| 427 | h, err := obj.HashOf(ctx) |
| 428 | return h, err == nil && !h.IsEmpty(), err |
| 429 | } |
| 430 | |
| 431 | // GetTableNames implements the interface doltdb.RootValue. |
| 432 | func (root *RootValue) GetTableNames(ctx context.Context, schemaName string, includeRootObjects bool) ([]string, error) { |
nothing calls this directly
no test coverage detected