the message store.  We build the index of any currently stored items.
358981
public void eventRestored() throws SevereMessageStoreException {
    super.eventRestored();
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.entry(this, tc, "eventRestored");
    try {
      NonLockingCursor cursor = newNonLockingItemCursor(null);
      AbstractItem item = cursor.next();
      while (item != null) {
        if (item instanceof SchemaStoreItem) {
          addToIndex((SchemaStoreItem)item);
          if (TraceComponent.isAnyTracingEnabled() && tc.isDebugEnabled()) SibTr.debug(this, tc, "JSchema found in store: " + ((SchemaStoreItem)item).getSchema().getID());
        }
        item = cursor.next();
      }
    } catch (MessageStoreException e) {
      FFDCFilter.processException(e, "eventRestored", "108", this);
    }
    if (TraceComponent.isAnyTracingEnabled() && tc.isEntryEnabled()) SibTr.exit(this, tc, "eventRestored");
  }
465062
public function perform()
    {
        $this->debugLog('Ensuring indexes for tenant=' . $this->args[self::STORENAME_KEY]. ', reindex=' . $this->args[self::REINDEX_KEY] . ', background=' . $this->args[self::BACKGROUND_KEY]);

        $this->getIndexUtils()->ensureIndexes(
            $this->args[self::REINDEX_KEY],
            $this->args[self::STORENAME_KEY],
            $this->args[self::BACKGROUND_KEY]
        );
    }
1276362
void store(IndexReader reader, String field, String prefix, ValueIndex value)
   {
      synchronized (cache)
      {
         Map<Key, ValueIndex> readerCache = cache.get(reader);
         if (readerCache == null)
         {
            readerCache = new HashMap<Key, ValueIndex>();
            cache.put(reader, readerCache);
         }
         readerCache.put(new Key(field, prefix), value);
      }
   }
662724
public GraphHopperStorage build() {
        Directory dir = mmap ?
                new MMapDirectory(location) :
                new RAMDirectory(location, store);

        GraphExtension graphExtension = encodingManager.needsTurnCostsSupport() ?
                new TurnCostExtension() :
                new TurnCostExtension.NoOpExtension();

        return singleCHWeighting == null ?
                new GraphHopperStorage(dir, encodingManager, elevation, graphExtension) :
                edgeBasedCH ?
                        new GraphHopperStorage(Collections.<Weighting>emptyList(), Arrays.asList(singleCHWeighting), dir, encodingManager, elevation, graphExtension) :
                        new GraphHopperStorage(Arrays.asList(singleCHWeighting), Collections.<Weighting>emptyList(), dir, encodingManager, elevation, graphExtension);
    }
324586
function(index, model) {
    var itemToIndex = {};
    // index all available fields for the item
    for (var i in this.config.indexes[index].indexFields) {
      var name = this.config.indexes[index].indexFields[i].name;
      if (typeof model.attributes[name] !== 'undefined' &&
          model.attributes[name] !== null) {
        var value = model.attributes[name];
        // first convert arrays to strings (we assume they are arrays of strings)
        if (Array.isArray(value)) {
          value = value.join(' ');
        }
        itemToIndex[name] = value;
      } else {
        itemToIndex[name] = '';
      }
    }
    // set the unique identifier
    itemToIndex.cid = model.cid;
    // index the item
    this.config.indexes[index].idx.add(itemToIndex);

    var itemForContent = {};
    // save all available content for the item
    for (var i in this.config.indexes[index].contentFields) {
      var name = this.config.indexes[index].contentFields[i].name;
      if (typeof model.attributes[name] !== 'undefined' &&
          model.attributes[name] !== null) {
        itemForContent[name] = model.attributes[name];
      }
    }
    // save it, keyed to its cid, for easy retrieval
    this.config.indexes[index].content[model.cid] = itemForContent;
  }
142946
public RepeatedFieldBuilder<MType, BType, IType> setMessage(
      int index, MType message) {
    if (message == null) {
      throw new NullPointerException();
    }
    ensureMutableMessageList();
    messages.set(index, message);
    if (builders != null) {
      SingleFieldBuilder<MType, BType, IType> entry =
          builders.set(index, null);
      if (entry != null) {
        entry.dispose();
      }
    }
    onChanged();
    incrementModCounts();
    return this;
  }
656460
def _Build(self, storage_file):
    
    self._index = {}
    for event_tag in storage_file.GetEventTags():
      self.SetEventTag(event_tag)
435081
def store_data(self, data):
        
        self.ch.basic_publish(exchange='', routing_key=self.store_queue,
            properties=pika.BasicProperties(delivery_mode=2), body=data)
510560
def getStore(self) :
        """"""
        res = {}
        res.update(self.store)
        for k, v in self.subStores.items() :
            res[k] = v.getStore()
        
        return res
1336356
def create_index(self, key, reindex=True, sparse=False):
        
        warnings.warn('Index support is currently very alpha and is not guaranteed')
        if isinstance(key, (list, tuple)):
            index_name = ','.join(key)
            index_columns = ', '.join('%s text' % f for f in key)
        else:
            index_name = key
            index_columns = '%s text' % key

        table_name = '[%s{%s}]' % (self.name, index_name)
        reindex = reindex or not self._object_exists('table', table_name)

        # Create a table store for the index data
        self.db.execute("""
            create table if not exists {table} (
                id integer primary key,
                {columns},
                foreign key(id) references {collection}(id) on delete cascade on update cascade
            )
        """.format(
            table=table_name,
            collection=self.name,
            columns=index_columns
        ))

        # Create the index
        self.db.execute("""
            create index if not exists [idx.{collection}{{index}}] on {table}({index})
        """.format(
            collection=self.name,
            index=index_name,
            table=table_name,
        ))

        if reindex:
            self.reindex(key)
174162
def update_item(message_ids, opts={})
      opts = check_opts(UPDATE_ITEM_OPTS, opts)
      message_ids = message_ids.result if message_ids.is_a?(Folder::FindResult)

      updates = [*opts[:updates]].compact
      raise "no updates!" if updates.empty?
      r = with_error_check(self, :update_item_response, :response_messages, :update_item_response_message) do
        self.savon_client.request(:wsdl, "UpdateItem", 
                                  :ConflictResolution=>opts[:conflict_resolution],
                                  :MessageDisposition=>opts[:message_disposition]) do
          http.headers["SOAPAction"] = "\"#{SCHEMA_MESSAGES}/UpdateItem\"" # required by EWS 2007
          soap.namespaces["xmlns:t"]=SCHEMA_TYPES
          
          xml = Builder::XmlMarkup.new
          
          xml.wsdl :ItemChanges do
            message_ids.each do |mid|
              mid = mid.item_id if mid.is_a?(Item::Item)
              xml.t :ItemChange do
                xml << mid.to_xml(opts[:ignore_change_keys])
                xml.t :Updates do
                  updates.each do |update|
                    xml << update.to_xml
                  end
                end
              end
            end
          end
          
          soap.body = xml.target!
        end
      end
      r
    end
607217
def _BuildIndex(self):
        """"""
        self._index = {}
        for i, k in enumerate(self._keys):
            self._index[k] = i
624558
public void displayNewIncomingMessageItem(ApptentiveMessage message) {
		messagingActionHandler.sendEmptyMessage(MSG_REMOVE_STATUS);
		// Determine where to insert the new incoming message. It will be in front of any eidting
		// area, i.e. composing, Who Card ...
		int insertIndex = listItems.size(); // If inserted onto the end, then the list will have grown by one.

		outside_loop:
		// Starting at end of list, go back up the list to find the proper place to insert the incoming message.
		for (int i = listItems.size() - 1; i > 0; i--) {
			MessageCenterListItem item = listItems.get(i);
			switch (item.getListItemType()) {
				case MESSAGE_COMPOSER:
				case MESSAGE_CONTEXT:
				case WHO_CARD:
				case STATUS:
					insertIndex--;
					break;
				default:
					// Any other type means we are past the temporary items.
					break outside_loop;
			}
		}
		listItems.add(insertIndex, message);
		messageCenterRecyclerViewAdapter.notifyItemInserted(insertIndex);

		int firstIndex = messageCenterRecyclerView.getFirstVisiblePosition();
		int lastIndex = messageCenterRecyclerView.getLastVisiblePosition();
		boolean composingAreaTakesUpVisibleArea = firstIndex <= insertIndex && insertIndex < lastIndex;
		if (composingAreaTakesUpVisibleArea) {
			View v = messageCenterRecyclerView.getChildAt(0);
			int top = (v == null) ? 0 : v.getTop();
			updateMessageSentStates();
			// Restore the position of listview to composing view
			messagingActionHandler.sendMessage(messagingActionHandler.obtainMessage(MSG_SCROLL_FROM_TOP, insertIndex, top));
		} else {
			updateMessageSentStates();
		}
	}
1266358
def _get(self, *args, **kwargs):
        
        all_messages = []
        for storage in self.storages:
            messages, all_retrieved = storage._get()
            # If the backend hasn't been used, no more retrieval is necessary.
            if messages is None:
                break
            if messages:
                self._used_storages.add(storage)
            all_messages.extend(messages)
            # If this storage class contained all the messages, no further
            # retrieval is necessary
            if all_retrieved:
                break
        return all_messages, all_retrieved
1073951
private void grow() {
    final int newsize = store.length + (store.length >>> 1);
    final int[] prev = store;
    store = new int[newsize];
    System.arraycopy(prev, 0, store, 0, size);
  }
708736
function (callback) {
            var idx = this.indexer.all()
            ,   r   = []
            ,   o
            ,   k
            for (var i = 0, l = idx.length; i < l; i++) {
                k     = idx[i] //v
                o     = JSON.parse(storage.getItem(k))
                o.key = k.replace(this.name + '.', '')
                r.push(o)
            }
            if (callback) this.fn(this.name, callback).call(this, r)
            return this
        }
1257512
void fetchAndStoreMessages(final boolean isMessageCenterForeground, final boolean showToast, @Nullable final MessageFetchListener listener) {
		checkConversationQueue();

		try {
			String lastMessageId = messageStore.getLastReceivedMessageId();
			fetchMessages(lastMessageId, new MessageFetchListener() {
				@Override
				public void onFetchFinish(MessageManager messageManager, List<ApptentiveMessage> messages) {
					try {
						if (messages == null || messages.size() == 0) return;

						CompoundMessage messageOnToast = null;
						ApptentiveLog.d(MESSAGES,"Messages retrieved: %d", messages.size());

						// Also get the count of incoming unread messages.
						int incomingUnreadMessages = 0;
						// Mark messages from server where sender is the app user as read.
						for (final ApptentiveMessage apptentiveMessage : messages) {
							if (apptentiveMessage.isOutgoingMessage()) {
								apptentiveMessage.setRead(true);
							} else {
								if (messageOnToast == null) {
									if (apptentiveMessage.getMessageType() == ApptentiveMessage.Type.CompoundMessage) {
										messageOnToast = (CompoundMessage) apptentiveMessage;
									}
								}
								incomingUnreadMessages++;

								// for every new message received, notify Message Center
								notifyInternalNewMessagesListeners((CompoundMessage) apptentiveMessage);
							}
						}
						messageStore.addOrUpdateMessages(messages.toArray(new ApptentiveMessage[messages.size()]));
						if (incomingUnreadMessages > 0) {
							// Show toast notification only if the foreground activity is not already message center activity
							if (!isMessageCenterForeground && showToast) {
								DispatchQueue.mainQueue().dispatchAsyncOnce(toastMessageNotifierTask.setMessage(messageOnToast));
							}
						}

						// Send message to notify host app, such as unread message badge
						conversationQueue().dispatchAsyncOnce(hostMessageNotifierTask.setMessageCount(getUnreadMessageCount()));
					} finally {
						if (listener != null) {
							listener.onFetchFinish(messageManager, messages);
						}
					}
				}
			});
		} catch (Exception e) {
			ApptentiveLog.e(MESSAGES, "Error retrieving last received message id from worker thread");
			logException(e);
		}
	}