Package com.taobao.common.store.util

Examples of com.taobao.common.store.util.BytesKey


            }


            @Override
            public byte[] next() {
                final BytesKey bk = it.next();
                if (null != bk) {
                    return bk.getData();
                }
                return null;
            }

View Full Code Here


     * @return �Ƿ�ɾ��������
     * @throws IOException
     */
    private boolean innerRemove(final byte[] key, final boolean sync) throws IOException {
        boolean ret = false;
        final BytesKey k = new BytesKey(key);
        final OpItem op = this.indices.get(k);
        if (null != op) {
            ret = this.innerRemove(op, k, sync);
            if (ret) {
                this.indices.remove(k);
View Full Code Here

                    log.warn("log file error:" + lf + ", index:" + i);
                    continue;
                }
                final OpItem op = new OpItem();
                op.parse(bf.array());
                final BytesKey key = new BytesKey(op.key);
                switch (op.op) {
                case OpItem.OP_ADD: // �������ӵIJ����������������������ü���
                    final OpItem o = this.indices.get(key);
                    if (null != o) {
                        // �Ѿ���֮ǰ��ӹ�����ô��Ȼ��Update��ʱ��Remove�IJ�����־û��д�롣
View Full Code Here

     * @see com.taobao.common.store.Store#update(byte[], byte[])
     */
    @Override
    public boolean update(final byte[] key, final byte[] data) throws IOException {
        // ����Update����Ϣ������д��OpCodeΪUpdate����־��
        final BytesKey k = new BytesKey(key);
        final OpItem op = this.indices.get(k);
        if (null != op) {
            this.indices.remove(k);
            final OpItem o = this.innerAdd(key, data, -1, false);
            if (o.number != op.number) {
View Full Code Here

     * @throws IOException
     */
    @Override
    public void check() throws IOException {
        final Iterator<byte[]> keys = this.iterator();
        BytesKey key = null;
        final long now = System.currentTimeMillis();
        long time;
        log.warn("Store4j�����ļ�����ʼ...");
        while (keys.hasNext()) {
            key = new BytesKey(keys.next());
            time = this.lastModifiedMap.get(key);
            if (this.intervalForRemove != -1 && now - time > this.intervalForRemove) {
                this.innerRemove(key.getData(), true);
            }
            else if (now - time > this.intervalForCompact) {
                this.reuse(key.getData(), true);
            }
        }
        log.warn("Store4j�����ļ��������...");
    }
View Full Code Here

                    currentIndex++;
                }
                if (!table[currentIndex].isLoaded()) {
                    table[currentIndex].load(mappedByteBuffer, OpItemHashMap.this.calcOffset(currentIndex), true);
                }
                final BytesKey key = new BytesKey(table[currentIndex].getOpItem().getKey());
                this.currentIndex++;
                this.lastRet++;
                return key;
            }
            catch (final IOException e) {
View Full Code Here

        @Override
        public BytesKey next() {
            lock.lock();
            try {
                BytesKey result = null;
                if (!enterDisk) {
                    result = mapIt.next();
                }
                else {
                    result = diskMapIt.next();
View Full Code Here

            @Override
            public BytesKey next() {
                MessageIndexMap.this.lock.lock();
                try {
                    BytesKey result = null;
                    result = this.mapIterator.next();
                    this.currentKey = result;
                    return result;
                }
                finally {
View Full Code Here

TOP

Related Classes of com.taobao.common.store.util.BytesKey

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.