| 60 | } |
| 61 | |
| 62 | export class BlobClient implements MetadataClient { |
| 63 | dataSources: Record<string, DataSource>; |
| 64 | |
| 65 | constructor(dataSources: Record<string, DataSource>) { |
| 66 | this.dataSources = dataSources; |
| 67 | } |
| 68 | |
| 69 | track(account: string, container: string, filepath: string): Promise<Track> { |
| 70 | throw new Error('track not supported for blob data sources'); |
| 71 | } |
| 72 | |
| 73 | async getMeta(account: string, container: string, filePath: string): Promise<SigMFMetadata> { |
| 74 | const containerClient = getContainerClient(this.dataSources, account, container); |
| 75 | return blobNameToMetadata(filePath, containerClient); |
| 76 | } |
| 77 | |
| 78 | async getDataSourceMetaPaths(account: string, container: string): Promise<string[]> { |
| 79 | const containerClient = getContainerClient(this.dataSources, account, container); |
| 80 | const blobNames: Array<string> = []; |
| 81 | for await (const i of containerClient.listBlobsFlat()) blobNames.push(i.name); |
| 82 | const blobsToProcess = blobNames.filter( |
| 83 | (blobName) => |
| 84 | blobName.split('.').pop() === 'sigmf-meta' && blobNames.includes(blobName.split('.')[0] + '.sigmf-data') |
| 85 | ); |
| 86 | return blobsToProcess; |
| 87 | } |
| 88 | |
| 89 | async updateMeta(account: string, container: string, filePath: string, meta: SigMFMetadata): Promise<any> { |
| 90 | // Currently update meta doesnt even try to update the blob so we are just going to return here |
| 91 | return meta; |
| 92 | } |
| 93 | |
| 94 | async smartQuery(queryString: string): Promise<any> { |
| 95 | throw new Error('smartQuery not supported for blob data sources'); |
| 96 | } |
| 97 | |
| 98 | features() { |
| 99 | return { |
| 100 | canUpdateMeta: false, |
| 101 | }; |
| 102 | } |
| 103 | } |
nothing calls this directly
no outgoing calls
no test coverage detected