Index a specific payload

@param oid
: The identifier of the payload's object
@param pid
: The identifier of the payload
@throws IndexerException
if there were errors during indexing
329954
@Override
	public void index(String oid, String pid) throws IndexerException {
		try {
			DigitalObject object = storage.getObject(oid);
			Payload payload = object.getPayload(pid);
			index(object, payload);
		} catch (StorageException ex) {
			throw new IndexerException(ex);
		}
	}
106539
public void remove(Identity oid)
    {
        //processQueue();
        if(oid != null)
        {
            removeTracedIdentity(oid);
            objectTable.remove(buildKey(oid));
            if(log.isDebugEnabled()) log.debug("Remove object " + oid);
        }
    }
452023
public int ENgetnodeindex( String id ) throws EpanetException {
        int[] index = new int[1];
        int error = epanet.ENgetnodeindex(id, index);
        checkError(error);
        return index[0];
    }
673407
@Override
    public void index(Class entityClazz, EntityMetadata m, Map<String, Object> values, Object parentId,
            Class parentClazz)
    {
        Set<String> indexNames = values.keySet();
        for (String idx_Name : indexNames)
        {
            Double value = (Double) values.get(idx_Name);
            Pipeline pipeLine = null;
            try
            {
                if (this.pipeLineOrConnection.getClass().isAssignableFrom(Jedis.class))
                {
                    pipeLine = ((Jedis) this.pipeLineOrConnection).pipelined();
                    pipeLine.zadd(idx_Name, value, parentId.toString());
                    // pipeLine.sync();
                }
                else
                {
                    ((Transaction) this.pipeLineOrConnection).zadd(idx_Name, value, parentId.toString());
                }
            }
            finally
            {
                if (pipeLine != null)
                {
                    pipeLine.sync();
                }
            }
        }

    }
1291479
private void esIndex(String index, String id, String json, String pipeline) {
        logger.debug("Indexing {}/{}?pipeline={}", index, id, pipeline);
        logger.trace("JSon indexed : {}", json);

        if (!closed) {
            esClient.index(index, id, json, pipeline);
        } else {
            logger.warn("trying to add new file while closing crawler. Document [{}]/[{}] has been ignored", index, id);
        }
    }
566976
def resolve(self, pid_value):
        
        pid = PersistentIdentifier.get(self.pid_type, pid_value)

        if pid.is_new() or pid.is_reserved():
            raise PIDUnregistered(pid)

        if pid.is_deleted():
            obj_id = pid.get_assigned_object(object_type=self.object_type)
            try:
                obj = self.object_getter(obj_id) if obj_id else None
            except NoResultFound:
                obj = None
            raise PIDDeletedError(pid, obj)

        if pid.is_redirected():
            raise PIDRedirectedError(pid, pid.get_redirect())

        obj_id = pid.get_assigned_object(object_type=self.object_type)
        if not obj_id:
            raise PIDMissingObjectError(self.pid_type, pid_value)

        return pid, self.object_getter(obj_id)
646025
private synchronized long nextId(boolean isPadding, long busId) {

        long timestamp = timeGen();
        long paddingnum = regionId;

        if (isPadding) {
            paddingnum = busId;
        }

        if (timestamp < lastTimestamp) {
            try {
                throw new Exception("Clock moved backwards.  Refusing to generate id for " + (lastTimestamp - timestamp) + " milliseconds");
            } catch (Exception e) {
                e.printStackTrace();
            }
        }

        //如果上次生成时间和当前时间相同,在同一毫秒内
        if (lastTimestamp == timestamp) {
            //sequence自增，因为sequence只有10bit，所以和sequenceMask相与一下，去掉高位
            sequence = (sequence + 1) & sequenceMask;
            //判断是否溢出,也就是每毫秒内超过1024，当为1024时，与sequenceMask相与，sequence就等于0
            if (sequence == 0) {
                //自旋等待到下一毫秒
                timestamp = tailNextMillis(lastTimestamp);
            }
        } else {
            // 如果和上次生成时间不同,重置sequence，就是下一毫秒开始，sequence计数重新从0开始累加,
            // 为了保证尾数随机性更大一些,最后一位设置一个随机数
            sequence = new SecureRandom().nextInt(10);
        }

        lastTimestamp = timestamp;

        return ((timestamp - twepoch) << timestampLeftShift) | (paddingnum << regionIdShift) | (workerId << workerIdShift) | sequence;
    }
220058
public void setID(String ID) {
        if (ID == null) {
            throw new NullPointerException();
        }
        if (isFrozen()) {
            throw new UnsupportedOperationException("Attempt to modify a frozen TimeZone instance.");
        }
        this.ID = ID;
    }
963368
def oaiid_minter(record_uuid, data):
    
    pid_value = data.get('_oai', {}).get('id')
    if pid_value is None:
        fetcher_name = \
            current_app.config.get('OAISERVER_CONTROL_NUMBER_FETCHER', 'recid')
        cn_pid = current_pidstore.fetchers[fetcher_name](record_uuid, data)
        pid_value = current_app.config.get('OAISERVER_ID_PREFIX', '') + str(
            cn_pid.pid_value
        )
    provider = OAIIDProvider.create(
        object_type='rec', object_uuid=record_uuid,
        pid_value=str(pid_value)
    )
    data.setdefault('_oai', {})
    data['_oai']['id'] = provider.pid.pid_value
    return provider.pid
106300
def reindex(pid_type):
    
    click.secho('Sending records to indexing queue ...', fg='green')

    query = (x[0] for x in PersistentIdentifier.query.filter_by(
        object_type='rec', status=PIDStatus.REGISTERED
    ).filter(
        PersistentIdentifier.pid_type.in_(pid_type)
    ).values(
        PersistentIdentifier.object_uuid
    ))
    RecordIndexer().bulk_index(query)
    click.secho('Execute "run" command to process the queue!',
                fg='yellow')
637086
def pid(self, value):
        """"""
        self.bytearray[self._get_slicers(0)] = bytearray(c_int32(value or 0))
266396
static String id(Object o) {
        if (o == null) return "(null)";
        Thread t = Thread.currentThread();
        StringBuilder sb = new StringBuilder(128);
        sb.append("(T[").append(t.getName()).append("]@");
        sb.append(Long.toString(t.getId(), Character.MAX_RADIX));
        sb.append(":O[").append(o.getClass().getSimpleName());
        sb.append("]@");
        sb.append(Long.toString(System.identityHashCode(o),Character.MAX_RADIX));
        sb.append(")");
        return sb.toString();
    }
1042655
@Override
	public void annotateRemove(String oid) throws IndexerException {
		log.debug("Deleting " + oid + " from Anotar index");
		try {
			anotar.deleteByQuery("rootUri:\"" + oid + "\"");
			anotar.commit();
		} catch (SolrServerException sse) {
			throw new IndexerException(sse);
		} catch (IOException ioe) {
			throw new IndexerException(ioe);
		}
	}
379498
private void seekToSId(final int pSId, final long pStreamSize) throws IOException {
        long pos;

        if (isShortStream(pStreamSize)) {
            // The short stream is not continuous...
            Entry root = getRootEntry();
            if (shortStreamSIdChain == null) {
                shortStreamSIdChain = getSIdChain(root.startSId, root.streamSize);
            }
            
//            System.err.println("pSId: " + pSId);
            int shortPerSId = sectorSize / shortSectorSize;
//            System.err.println("shortPerSId: " + shortPerSId);
            int offset = pSId / shortPerSId;
//            System.err.println("offset: " + offset);
            int shortOffset = pSId - (offset * shortPerSId);
//            System.err.println("shortOffset: " + shortOffset);
//            System.err.println("shortStreamSIdChain.offset: " + shortStreamSIdChain.get(offset));

            pos = HEADER_SIZE
                    + (shortStreamSIdChain.get(offset) * (long) sectorSize)
                    + (shortOffset * (long) shortSectorSize);
//            System.err.println("pos: " + pos);
        }
        else {
            pos = HEADER_SIZE + pSId * (long) sectorSize;
        }

        if (input instanceof LittleEndianRandomAccessFile) {
            ((LittleEndianRandomAccessFile) input).seek(pos);
        }
        else if (input instanceof ImageInputStream) {
            ((ImageInputStream) input).seek(pos);
        }
        else {
            ((SeekableLittleEndianDataInputStream) input).seek(pos);
        }
    }
998068
protected void indexNode(int expandedTypeID, int identity)
  {

    ExpandedNameTable ent = m_expandedNameTable;
    short type = ent.getType(expandedTypeID);

    if (DTM.ELEMENT_NODE == type)
    {
      int namespaceID = ent.getNamespaceID(expandedTypeID);
      int localNameID = ent.getLocalNameID(expandedTypeID);

      ensureSizeOfIndex(namespaceID, localNameID);

      int[] index = m_elemIndexes[namespaceID][localNameID];

      index[index[0]] = identity;

      index[0]++;
    }
  }
504280
@Override
    public void deleted(String pid) {
        final ServiceRegistration<T> registration = registrations.get(pid);
        if (registration != null) {
            LOGGER.info("Unregistering OSGi service for pid \"{}\"...", pid);
            final T service = bundleContext.getService(registration.getReference());
            registration.unregister();
            LOGGER.info("Destroying service object for pid \"{}\"...", pid);
            destroy(pid, service);
        }
    }
21359
def serialize_oaipmh(self, pid, record):
        
        obj = self.transform_record(pid, record['_source']) \
            if isinstance(record['_source'], Record) \
            else self.transform_search_hit(pid, record)

        return dumps_etree(obj, **self.dumps_kwargs)