示例#1
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeString(index.getName()); // uuid will come as part of settings
   out.writeLong(version);
   out.writeByte(state.id());
   writeSettingsToStream(settings, out);
   out.writeVInt(mappings.size());
   for (ObjectCursor<MappingMetaData> cursor : mappings.values()) {
     cursor.value.writeTo(out);
   }
   out.writeVInt(aliases.size());
   for (ObjectCursor<AliasMetaData> cursor : aliases.values()) {
     cursor.value.writeTo(out);
   }
   out.writeVInt(customs.size());
   for (ObjectObjectCursor<String, Custom> cursor : customs) {
     out.writeString(cursor.key);
     cursor.value.writeTo(out);
   }
   out.writeVInt(activeAllocationIds.size());
   for (IntObjectCursor<Set<String>> cursor : activeAllocationIds) {
     out.writeVInt(cursor.key);
     DiffableUtils.StringSetValueSerializer.getInstance().write(cursor.value, out);
   }
 }
示例#2
0
 @Override
 public void writeTo(StreamOutput out) throws IOException {
   out.writeLong(version);
   out.writeString(clusterUUID);
   writeSettingsToStream(transientSettings, out);
   writeSettingsToStream(persistentSettings, out);
   out.writeVInt(indices.size());
   for (IndexMetaData indexMetaData : this) {
     indexMetaData.writeTo(out);
   }
   out.writeVInt(templates.size());
   for (ObjectCursor<IndexTemplateMetaData> cursor : templates.values()) {
     cursor.value.writeTo(out);
   }
   out.writeVInt(customs.size());
   for (ObjectObjectCursor<String, Custom> cursor : customs) {
     out.writeString(cursor.key);
     cursor.value.writeTo(out);
   }
 }
 private static void assertContext(ActionRequest<?> request, Map<String, String> context) {
   if (context.size() == 0) {
     assertThat(request.isContextEmpty(), is(true));
   } else {
     ImmutableOpenMap map = request.getContext();
     assertThat(map, notNullValue());
     assertThat(map.size(), equalTo(context.size()));
     for (Object key : map.keys()) {
       assertThat(context.get(key), equalTo(request.getFromContext(key)));
     }
   }
 }
示例#4
0
 @Override
 protected int size(ImmutableOpenMap<Integer, V> map) {
   return map.size();
 }