Builds the Meta Map for use in the Sync Function. This meta map currently only includes the user xattr, however, this can be expanded upon in the future. NOTE: emptyMetaMap() is used within tests in channelmapper_test.go and therefore this should be expanded if the below is
(userXattrKey string)
| 446 | // can be expanded upon in the future. |
| 447 | // NOTE: emptyMetaMap() is used within tests in channelmapper_test.go and therefore this should be expanded if the below is |
| 448 | func (doc *Document) GetMetaMap(userXattrKey string) (map[string]interface{}, error) { |
| 449 | xattrsMap := map[string]interface{}{} |
| 450 | |
| 451 | if userXattrKey != "" { |
| 452 | var userXattr interface{} |
| 453 | |
| 454 | if len(doc.rawUserXattr) > 0 { |
| 455 | err := base.JSONUnmarshal(doc.rawUserXattr, &userXattr) |
| 456 | if err != nil { |
| 457 | return nil, err |
| 458 | } |
| 459 | } |
| 460 | xattrsMap[userXattrKey] = userXattr |
| 461 | } |
| 462 | |
| 463 | return map[string]interface{}{ |
| 464 | base.MetaMapXattrsKey: xattrsMap, |
| 465 | }, nil |
| 466 | } |
| 467 | |
| 468 | func (doc *Document) SetCrc32cUserXattrHash() { |
| 469 | doc.SyncData.Crc32cUserXattr = userXattrCrc32cHash(doc.rawUserXattr) |
no test coverage detected