Package org.lilyproject.repository.api

Examples of org.lilyproject.repository.api.TypeBucket


        return avroTypeBucket;
    }

    public TypeBucket convertAvroTypeBucket(AvroTypeBucket avroTypeBucket, TypeManager  typeManager)
            throws RepositoryException, InterruptedException {
        TypeBucket typeBucket = new TypeBucket(avroTypeBucket.getBucketId());
        for (AvroFieldType avroFieldType : avroTypeBucket.getFieldTypes()) {
            typeBucket.add(convert(avroFieldType, typeManager));
        }
        for (AvroRecordType avroRecordType : avroTypeBucket.getRecordTypes()) {
            typeBucket.add(convert(avroRecordType, typeManager));
        }
        return typeBucket;
    }
View Full Code Here


    @Override
    public AvroTypeBucket getTypeBucketWithoutCache(String bucketId)
            throws AvroRepositoryException, AvroInterruptedException {
        try {
            TypeBucket typeBucket = typeManager.getTypeBucketWithoutCache(bucketId);
            return converter.convertTypeBucket(typeBucket);
        } catch (RepositoryException e) {
            throw converter.convert(e);
        } catch (InterruptedException e) {
            throw converter.convert(e);
View Full Code Here

            if (log.isDebugEnabled()) {
                log.debug("Refreshing all types in the schema cache, limiting to buckets" + newBucketVersions.keySet());
            }
            for (Entry<String, Integer> entry : newBucketVersions.entrySet()) {
                bucketVersions.put(entry.getKey(), entry.getValue());
                TypeBucket typeBucket = getTypeManager().getTypeBucketWithoutCache(entry.getKey());
                fieldTypesCache.refreshFieldTypeBucket(typeBucket);
                updatedFieldTypes = true;
                recordTypes.refreshRecordTypeBucket(typeBucket);
            }
        }
View Full Code Here

                log.debug("Refreshing schema cache bucket: " + bucketId);
            }

            // Avoid updating the cache while refreshing the buckets
            bucketVersions.put(bucketId, stat.getVersion());
            TypeBucket typeBucket = getTypeManager().getTypeBucketWithoutCache(bucketId);
            fieldTypesCache.refreshFieldTypeBucket(typeBucket);
            recordTypes.refreshRecordTypeBucket(typeBucket);
        }
        updatedFieldTypes = true;
    }
View Full Code Here

        scan.addColumn(TypeCf.DATA.bytes, TypeColumn.RECORDTYPE_NAME.bytes);
        scan.addColumn(TypeCf.DATA.bytes, TypeColumn.VERSION.bytes);
        scan.addFamily(TypeCf.FIELDTYPE_ENTRY.bytes);
        scan.addFamily(TypeCf.SUPERTYPE.bytes);

        TypeBucket typeBucket = new TypeBucket(bucketId);
        ResultScanner scanner = null;
        byte[] rowPrefix = AbstractSchemaCache.decodeHexAndNextHex(bucketId);
        scan.setStartRow(new byte[]{rowPrefix[0]});
        if (!bucketId.equals("ff")) // In case of ff, just scan until
        // the end
        {
            scan.setStopRow(new byte[]{rowPrefix[1]});
        }
        try {
            scanner = getTypeTable().getScanner(scan);
        } catch (IOException e) {
            throw new TypeException("Exception occurred while retrieving field types and record types without cache ",
                    e);
        }

        // Collect the results first and close the scanner as fast as possible
        List<Result> results = new ArrayList<Result>();
        for (Result scanResult : scanner) {
            // Skip empty results from the scanner
            if (scanResult != null && !scanResult.isEmpty()) {
                results.add(scanResult);
            }
        }
        Closer.close(scanner);

        // Now extract the record and field types from the results
        for (Result scanResult : results) {
            if (scanResult.getValue(TypeCf.DATA.bytes, TypeColumn.FIELDTYPE_NAME.bytes) != null) {
                typeBucket.add(extractFieldType(new SchemaIdImpl(scanResult.getRow()), scanResult));
            } else if (scanResult.getValue(TypeCf.DATA.bytes, TypeColumn.RECORDTYPE_NAME.bytes) != null) {
                typeBucket.addAll(extractRecordType(new SchemaIdImpl(scanResult.getRow()), null, scanResult));
            }
        }
        return typeBucket;
    }
View Full Code Here

TOP

Related Classes of org.lilyproject.repository.api.TypeBucket

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.