Package com.fasterxml.storemate.store

Examples of com.fasterxml.storemate.store.Storable


                    metadata2, ByteContainer.simple(CUSTOM_METADATA_REPLACE),
                    true, checker);

            _verifyCounts(1L, store);

            final Storable oldEntry = resp.getPreviousEntry();
            assertNotNull(oldEntry);
            assertTrue(oldEntry.hasExternalData());
           
            if (expSuccess) { // yes, ought to overwrite:
                assertTrue("Should succeeed with checker "+checker, resp.succeeded());
            } else { // nope, original retained
                assertFalse("Should fail with checker "+checker, resp.succeeded());
            }

            // and then verify
            Storable entry = store.findEntry(StoreOperationSource.REQUEST, null, KEY1);
            assertNotNull(entry);
            assertFalse(entry.hasInlineData());
            assertTrue(entry.hasExternalData());
            assertEquals(Compression.LZF, entry.getCompression());

            if (expSuccess) {
                assertEquals(START_TIME_0 + 1000L, entry.getLastModified());
                assertEquals(DATA_REPLACE.length, entry.getOriginalLength());
                assertEquals(DATA_REPLACE.length, entry.getActualUncompressedLength());
                _verifyMetadata(entry, CUSTOM_METADATA_REPLACE);
            } else {
                assertEquals(START_TIME_0, entry.getLastModified());
                assertEquals(DATA_ORIG.length, entry.getOriginalLength());
                assertEquals(DATA_ORIG.length, entry.getActualUncompressedLength());
                _verifyMetadata(entry, CUSTOM_METADATA_ORIG);
            }
            // and read the contents
            File f = entry.getExternalFile(store.getFileManager());
            if (!f.exists()) {
                fail("File '"+f.getAbsolutePath()+"' (replacement? "+expSuccess+") should exist, does not");
            }
            byte[] b = readFile(f);
            byte[] uncomp = Compressors.lzfUncompress(b);
View Full Code Here


        int left = reader.left();
        if (left > 0) {
            throw new IllegalArgumentException("Had "+left+" bytes left after decoding entry (out of "
                    +raw.length+")");
        }
        return new Storable(key, ByteContainer.simple(raw, offset, length),
                lastmod, statusFlags, compression, externalPathLength,
                contentHash, compressedHash, originalLength,
                metadataOffset, metadataLength,
                payloadOffset, storageLength
            );
View Full Code Here

            writer.appendBytes(inlineData);
        }
        if (!createStorable) {
            return null;
        }
        return new Storable(key, writer.bufferedBytes(), modtime,
                stdMetadata.statusAsByte(), stdMetadata.compression, 0,
                stdMetadata.contentHash, stdMetadata.compressedContentHash, stdMetadata.uncompressedSize,
                metadataOffset, metadataLength,
                payloadOffset, stdMetadata.storageSize);
    }
View Full Code Here

        writer.appendBytes(rawRef);

        if (!createStorable) {
            return null;
        }
        return new Storable(key, writer.bufferedBytes(), modtime,
                stdMetadata.statusAsByte(), stdMetadata.compression, rawRef.length,
                stdMetadata.contentHash, stdMetadata.compressedContentHash, stdMetadata.uncompressedSize,
                metadataOffset, metadataLength,
                payloadOffset, stdMetadata.storageSize);
    }
View Full Code Here

        if (removeExternal) {
            // note: single byte, not variable length, hence plain zero
            base[OFFSET_EXT_PATH_LENGTH] = 0;
        }
        _ovewriteTimestamp(base, 0, deletionTime);
        Storable mod = orig.softDeletedCopy(ByteContainer.simple(base), true, deletionTime);
        return mod;
    }
View Full Code Here

        ArrayList<E> entries = new ArrayList<E>(ids.size());
        StorableStore store = _stores.getEntryStore();

        try {
            for (StorableKey key : ids) {
                Storable raw = store.findEntry(key);
                // note: this may give null as well; caller needs to check (converter passes null as-is)
                E entry = (E) _entryConverter.entryFromStorable(raw);
                entries.add(entry);
            }
        } catch (StoreException e) {
View Full Code Here

    public SyncPullEntry() { }

    SyncPullEntry(StoredEntry<?> src)
    {
        final Storable raw = src.getRaw();
        key = src.getKey().asStorableKey();
        creationTime = src.getCreationTime();
        checksum = raw.getContentHash();
        checksumForCompressed = raw.getCompressedHash();
       
        if (src.isDeleted()) {
            storageSize = -1L;
            size = -1L;
        } else {
            storageSize = raw.getStorageLength();
            size = raw.getOriginalLength();
        }
        compression = raw.getCompression();
        LastAccessUpdateMethod m = src.getLastAccessUpdateMethod();
        lastAccessMethod = (m == null) ? 0 : m.asByte();
        minTTLSecs = src.getMinTTLSinceAccessSecs();
        maxTTLSecs = src.getMaxTTLSecs();
       
View Full Code Here

        StorableStore store = _stores.getEntryStore();

        try {
            for (StorableKey key : ids) {
                // null -> let's not pass 'metadata' yet since we don't use timings?
                Storable raw = store.findEntry(StoreOperationSource.SYNC, null, key);
                // note: this may give null as well; caller needs to check (converter passes null as-is)
                E entry = (E) _entryConverter.entryFromStorable(raw);
                entries.add(entry);
            }
        } catch (StoreException e) {
View Full Code Here

        if (timer != null) {
            timer.stop();
        }
        if (opStats != null) {
            if (_metricSizes != null) {
                Storable entity = opStats.getEntry();
                if (entity != null) {
                    _metricSizes.update(entity.getActualUncompressedLength());
                }
            }
            if (_metricEntryCounts != null) {
                _metricEntryCounts.update(opStats.getItemCount());
            }
View Full Code Here

TOP

Related Classes of com.fasterxml.storemate.store.Storable

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.