File tree Expand file tree Collapse file tree 5 files changed +14
-8
lines changed
test/java/org/opensearch/gateway/remote/model Expand file tree Collapse file tree 5 files changed +14
-8
lines changed Original file line number Diff line number Diff line change 8
8
9
9
package org .opensearch .common .remote ;
10
10
11
+ import org .opensearch .common .annotation .ExperimentalApi ;
11
12
import org .opensearch .core .action .ActionListener ;
12
13
13
14
import java .io .IOException ;
18
19
* @param <T> The object type which can be uploaded to or downloaded from remote storage.
19
20
* @param <U> The wrapper entity which provides methods for serializing/deserializing entity T.
20
21
*/
22
+ @ ExperimentalApi
21
23
public interface RemoteWritableEntityStore <T , U extends RemoteWriteableEntity <T >> {
22
24
23
25
public void writeAsync (U entity , ActionListener <Void > listener );
Original file line number Diff line number Diff line change 8
8
9
9
package org .opensearch .common .remote ;
10
10
11
+ import org .opensearch .common .annotation .ExperimentalApi ;
12
+
11
13
import java .io .IOException ;
12
14
import java .io .InputStream ;
13
15
17
19
*
18
20
* @param <T> The object type which can be uploaded to or downloaded from remote storage.
19
21
*/
22
+ @ ExperimentalApi
20
23
public interface RemoteWriteableEntity <T > {
21
24
/**
22
25
* @return An InputStream created by serializing the entity T
Original file line number Diff line number Diff line change @@ -36,6 +36,8 @@ public class RemoteClusterMetadataManifest extends AbstractRemoteWritableBlobEnt
36
36
37
37
public static final String METADATA_MANIFEST_NAME_FORMAT = "%s" ;
38
38
public static final int MANIFEST_CURRENT_CODEC_VERSION = ClusterMetadataManifest .CODEC_V3 ;
39
+ public static final String COMMITTED = "C" ;
40
+ public static final String PUBLISHED = "P" ;
39
41
40
42
/**
41
43
* Manifest format compatible with older codec v0, where codec version was missing.
@@ -93,11 +95,10 @@ public String generateBlobFileName() {
93
95
MANIFEST ,
94
96
RemoteStoreUtils .invertLong (clusterMetadataManifest .getClusterTerm ()),
95
97
RemoteStoreUtils .invertLong (clusterMetadataManifest .getStateVersion ()),
96
- (clusterMetadataManifest .isCommitted () ? "C" : "P" ), // C for committed and P for published
98
+ (clusterMetadataManifest .isCommitted () ? COMMITTED : PUBLISHED ),
97
99
RemoteStoreUtils .invertLong (System .currentTimeMillis ()),
98
- String .valueOf (clusterMetadataManifest .getCodecVersion ()) // Keep the codec version at last place only, during read we reads
99
- // last place to
100
- // determine codec version.
100
+ String .valueOf (clusterMetadataManifest .getCodecVersion ())
101
+ // Keep the codec version at last place only, during we read last place to determine codec version.
101
102
);
102
103
this .blobFileName = blobFileName ;
103
104
return blobFileName ;
Original file line number Diff line number Diff line change 22
22
23
23
import static org .opensearch .gateway .remote .RemoteClusterStateUtils .METADATA_NAME_FORMAT ;
24
24
25
+ /**
26
+ * Wrapper class for uploading/downloading global metadata ({@link Metadata}) to/from remote blob store
27
+ */
25
28
public class RemoteGlobalMetadata extends AbstractRemoteWritableBlobEntity <Metadata > {
26
29
27
30
public static final ChecksumBlobStoreFormat <Metadata > GLOBAL_METADATA_FORMAT = new ChecksumBlobStoreFormat <>(
@@ -30,9 +33,6 @@ public class RemoteGlobalMetadata extends AbstractRemoteWritableBlobEntity<Metad
30
33
Metadata ::fromXContent
31
34
);
32
35
33
- private Metadata metadata ;
34
- private final String blobName ;
35
-
36
36
public RemoteGlobalMetadata (
37
37
final String blobName ,
38
38
final String clusterUUID ,
Original file line number Diff line number Diff line change @@ -160,7 +160,7 @@ public void testGetUploadedMetadata() throws IOException {
160
160
try (InputStream inputStream = remoteObjectForUpload .serialize ()) {
161
161
remoteObjectForUpload .setFullBlobName (new BlobPath ().add (TEST_BLOB_PATH ));
162
162
UploadedMetadata uploadedMetadata = remoteObjectForUpload .getUploadedMetadata ();
163
- assertThat (uploadedMetadata .getUploadedFilename (), is (remoteObjectForUpload .getFullBlobName ()));
163
+ assertThat (uploadedMetadata .getUploadedFilename (), is (remoteObjectForUpload .getBlobFileName ()));
164
164
}
165
165
}
166
166
You can’t perform that action at this time.
0 commit comments