Errors returned are: os.ErrNotExist -- blob not found os.ErrInvalid -- not JSON or a camli schema blob
(ctx context.Context, br blob.Ref)
| 340 | // os.ErrNotExist -- blob not found |
| 341 | // os.ErrInvalid -- not JSON or a camli schema blob |
| 342 | func (fs *CamliFileSystem) fetchSchemaMeta(ctx context.Context, br blob.Ref) (*schema.Blob, error) { |
| 343 | blobStr := br.String() |
| 344 | if blob, ok := fs.blobToSchema.Get(blobStr); ok { |
| 345 | return blob.(*schema.Blob), nil |
| 346 | } |
| 347 | |
| 348 | rc, _, err := fs.fetcher.Fetch(ctx, br) |
| 349 | if err != nil { |
| 350 | return nil, err |
| 351 | } |
| 352 | defer rc.Close() |
| 353 | blob, err := schema.BlobFromReader(br, rc) |
| 354 | if err != nil { |
| 355 | Logger.Printf("Error parsing %s as schema blob: %v", br, err) |
| 356 | return nil, os.ErrInvalid |
| 357 | } |
| 358 | if blob.Type() == "" { |
| 359 | Logger.Printf("blob %s is JSON but lacks camliType", br) |
| 360 | return nil, os.ErrInvalid |
| 361 | } |
| 362 | fs.blobToSchema.Add(blobStr, blob) |
| 363 | return blob, nil |
| 364 | } |
| 365 | |
| 366 | // consolated logic for determining a node to mount based on an arbitrary blobref |
| 367 | func (fs *CamliFileSystem) newNodeFromBlobRef(root blob.Ref) (fusefs.Node, error) { |