@@ -51,7 +51,7 @@ public class AzureBlobContainer extends AbstractBlobContainer {
51
51
@ Override
52
52
public boolean blobExists (OperationPurpose purpose , String blobName ) throws IOException {
53
53
logger .trace ("blobExists({})" , blobName );
54
- return blobStore .blobExists (buildKey (blobName ));
54
+ return blobStore .blobExists (purpose , buildKey (blobName ));
55
55
}
56
56
57
57
private InputStream openInputStream (OperationPurpose purpose , String blobName , long position , @ Nullable Long length )
@@ -68,7 +68,7 @@ private InputStream openInputStream(OperationPurpose purpose, String blobName, l
68
68
throw new NoSuchFileException ("Blob [" + blobKey + "] not found" );
69
69
}
70
70
try {
71
- return blobStore .getInputStream (blobKey , position , length );
71
+ return blobStore .getInputStream (purpose , blobKey , position , length );
72
72
} catch (Exception e ) {
73
73
if (ExceptionsHelper .unwrap (e , HttpResponseException .class ) instanceof HttpResponseException httpResponseException ) {
74
74
final var httpStatusCode = httpResponseException .getResponse ().getStatusCode ();
@@ -102,7 +102,7 @@ public long readBlobPreferredLength() {
102
102
public void writeBlob (OperationPurpose purpose , String blobName , InputStream inputStream , long blobSize , boolean failIfAlreadyExists )
103
103
throws IOException {
104
104
logger .trace ("writeBlob({}, stream, {})" , buildKey (blobName ), blobSize );
105
- blobStore .writeBlob (buildKey (blobName ), inputStream , blobSize , failIfAlreadyExists );
105
+ blobStore .writeBlob (purpose , buildKey (blobName ), inputStream , blobSize , failIfAlreadyExists );
106
106
}
107
107
108
108
@ Override
@@ -117,14 +117,13 @@ public void writeBlobAtomic(
117
117
}
118
118
119
119
@ Override
120
- public void writeBlobAtomic (OperationPurpose purpose , String blobName , BytesReference bytes , boolean failIfAlreadyExists )
121
- throws IOException {
120
+ public void writeBlobAtomic (OperationPurpose purpose , String blobName , BytesReference bytes , boolean failIfAlreadyExists ) {
122
121
writeBlob (purpose , blobName , bytes , failIfAlreadyExists );
123
122
}
124
123
125
124
@ Override
126
- public void writeBlob (OperationPurpose purpose , String blobName , BytesReference bytes , boolean failIfAlreadyExists ) throws IOException {
127
- blobStore .writeBlob (buildKey (blobName ), bytes , failIfAlreadyExists );
125
+ public void writeBlob (OperationPurpose purpose , String blobName , BytesReference bytes , boolean failIfAlreadyExists ) {
126
+ blobStore .writeBlob (purpose , buildKey (blobName ), bytes , failIfAlreadyExists );
128
127
}
129
128
130
129
@ Override
@@ -135,12 +134,12 @@ public void writeMetadataBlob(
135
134
boolean atomic ,
136
135
CheckedConsumer <OutputStream , IOException > writer
137
136
) throws IOException {
138
- blobStore .writeBlob (buildKey (blobName ), failIfAlreadyExists , writer );
137
+ blobStore .writeBlob (purpose , buildKey (blobName ), failIfAlreadyExists , writer );
139
138
}
140
139
141
140
@ Override
142
- public DeleteResult delete (OperationPurpose purpose ) throws IOException {
143
- return blobStore .deleteBlobDirectory (keyPath );
141
+ public DeleteResult delete (OperationPurpose purpose ) {
142
+ return blobStore .deleteBlobDirectory (purpose , keyPath );
144
143
}
145
144
146
145
@ Override
@@ -161,7 +160,7 @@ public String next() {
161
160
@ Override
162
161
public Map <String , BlobMetadata > listBlobsByPrefix (OperationPurpose purpose , @ Nullable String prefix ) throws IOException {
163
162
logger .trace ("listBlobsByPrefix({})" , prefix );
164
- return blobStore .listBlobsByPrefix (keyPath , prefix );
163
+ return blobStore .listBlobsByPrefix (purpose , keyPath , prefix );
165
164
}
166
165
167
166
@ Override
@@ -173,7 +172,7 @@ public Map<String, BlobMetadata> listBlobs(OperationPurpose purpose) throws IOEx
173
172
@ Override
174
173
public Map <String , BlobContainer > children (OperationPurpose purpose ) throws IOException {
175
174
final BlobPath path = path ();
176
- return blobStore .children (path );
175
+ return blobStore .children (purpose , path );
177
176
}
178
177
179
178
protected String buildKey (String blobName ) {
@@ -199,7 +198,7 @@ private boolean skipIfNotPrimaryOnlyLocationMode(ActionListener<?> listener) {
199
198
@ Override
200
199
public void getRegister (OperationPurpose purpose , String key , ActionListener <OptionalBytesReference > listener ) {
201
200
if (skipRegisterOperation (listener )) return ;
202
- ActionListener .completeWith (listener , () -> blobStore .getRegister (buildKey (key ), keyPath , key ));
201
+ ActionListener .completeWith (listener , () -> blobStore .getRegister (purpose , buildKey (key ), keyPath , key ));
203
202
}
204
203
205
204
@ Override
@@ -211,7 +210,14 @@ public void compareAndExchangeRegister(
211
210
ActionListener <OptionalBytesReference > listener
212
211
) {
213
212
if (skipRegisterOperation (listener )) return ;
214
- ActionListener .completeWith (listener , () -> blobStore .compareAndExchangeRegister (buildKey (key ), keyPath , key , expected , updated ));
213
+ ActionListener .completeWith (
214
+ listener ,
215
+ () -> blobStore .compareAndExchangeRegister (purpose , buildKey (key ), keyPath , key , expected , updated )
216
+ );
215
217
}
216
218
219
+ // visible for testing
220
+ AzureBlobStore getBlobStore () {
221
+ return blobStore ;
222
+ }
217
223
}
0 commit comments