Package com.foundationdb.ais.model

Examples of com.foundationdb.ais.model.Group


                                                   AISValidationOutput output) {
        if (!(object instanceof Group)) {
            output.reportFailure(new AISValidationFailure(new StorageDescriptionInvalidException(object, "is not a Group and cannot use Protocol Buffers")));
            return null;
        }
        Group group = (Group)object;
        if (formatType == ProtobufRowFormat.Type.SINGLE_TABLE) {
            if (!group.getRoot().getChildJoins().isEmpty()) {
                output.reportFailure(new AISValidationFailure(new StorageDescriptionInvalidException(object, "has more than one table")));
                return null;
            }
        }
        int currentVersion = sumTableVersions(group.getRoot());
        if (fileProto != null) {
            int storedVersion = fileProto.getOptions()
                .getExtension(CustomOptions.GroupOptions.fdbsql).getVersion();
            if (storedVersion == currentVersion) {
                return fileProto;
View Full Code Here


        return sum;
    }

    static ProtobufRowDataConverter buildConverter(HasStorage object,
                                                   FileDescriptorProto fileProto) {
        Group group = (Group)object;
        FileDescriptor fileDescriptor;
        try {
            fileDescriptor = FileDescriptor.buildFrom(fileProto, DEPENDENCIES);
        }
        catch (DescriptorValidationException ex) {
View Full Code Here

                schemaName = currentSchema;
            else
                schemaName = value.getString();
            tableName = bindings.getValue(1).getString();
            TableName groupName = new TableName(schemaName, tableName);
            Group group = context.getStore().schema().ais().getGroup(groupName);
            if (group == null)
                throw new NoSuchGroupException(groupName);
            StorageDescription storage = group.getStorageDescription();
            if (!(storage instanceof ProtobufStorageDescription))
                throw new InvalidParameterValueException("group does not use STORAGE_FORMAT protobuf");
            FileDescriptorProto fileProto = ((ProtobufStorageDescription)storage).getFileProto();
            try {
                tempFile = File.createTempFile("group", ".proto");
View Full Code Here

    @Override
    public TableName registerMemoryInformationSchemaTable(final Table newTable, final MemoryTableFactory factory) {
        if(factory == null) {
            throw new IllegalArgumentException("MemoryTableFactory may not be null");
        }
        final Group group = newTable.getGroup();
        // Factory will actually get applied at the end of AISMerge.merge() onto
        // a new table.
        storageFormatRegistry.registerMemoryFactory(group.getName(), factory);
        try(Session session = sessionService.createSession()) {
            txnService.run(session, new Runnable() {
                @Override
                public void run() {
                    storageFormatRegistry.finishStorageDescription(group, getNameGenerator(session));
View Full Code Here

            txnService.rollbackTransactionIfOpen(session);
        }
    }

    private void dropGroupInternal(final Session session, TableName groupName) {
        final Group group = getAIS(session).getGroup(groupName);
        if(group == null) {
            return;
        }
        store().dropGroup(session, group);
        group.visit(new AbstractVisitor() {
            @Override
            public void visit(Table table) {
                for(TableListener listener : listenerService.getTableListeners()) {
                    listener.onDrop(session, table);
                }
            }
        });
        Table root = group.getRoot();
        schemaManager().dropTableDefinition(session, root.getName().getSchemaName(), root.getName().getTableName(),
                                            SchemaManager.DropBehavior.CASCADE);
    }
View Full Code Here

        if(indexNamesToDrop.isEmpty()) {
            return;
        }
        txnService.beginTransaction(session);
        try {
            final Group group = getAIS(session).getGroup(groupName);
            if (group == null) {
                throw new NoSuchGroupException(groupName);
            }
            Collection<Index> indexes = new HashSet<>();
            for(String indexName : indexNamesToDrop) {
                final Index index = group.getIndex(indexName);
                if(index == null) {
                    throw new NoSuchIndexException(indexName);
                }
                indexes.add(index);
            }
View Full Code Here

                sequencesToDrop.add(origAIS.getSequence(name));
            }
        }

        List<Index> indexesToDrop = new ArrayList<>();
        Group group = origTable.getGroup();
        for(String name : changeState.droppedGI) {
            indexesToDrop.add(group.getIndex(name));
        }

        List<HasStorage> storageToRemove = new ArrayList<>();
        for(TableChange ic : validator.getState().tableIndexChanges) {
            switch(ic.getChangeType()) {
View Full Code Here

                }
            }
        );

        List<Index> indexesToBuild = new ArrayList<>();
        Group origGroup = origTable.getGroup();
        Group tempGroup = tempAIS.getGroup(newTable.getGroup().getName());
        for(Entry<String, List<ColumnName>> entry : changeState.affectedGI.entrySet()) {
            GroupIndex origIndex = origGroup.getIndex(entry.getKey());
            GroupIndex tempIndex = GroupIndex.create(tempAIS, tempGroup, origIndex);
            int pos = 0;
            for(ColumnName cn : entry.getValue()) {
View Full Code Here

                    builder.setChange(ChangeSetHelper.createModifyChange(name, name));
                    cs.addIndexChange(builder);
                }
            }

            Group newGroup = newTable.getGroup();
            for(String indexName : validator.getState().dataAffectedGI.keySet()) {
                GroupIndex index = newGroup.getIndex(indexName);
                if(newTable.getGroupIndexes().contains(index)) {
                    TableChanges.IndexChange.Builder builder = TableChanges.IndexChange.newBuilder();
                    builder.setIndexType(index.getIndexType().name());
                    builder.setChange(ChangeSetHelper.createModifyChange(indexName, indexName));
                    cs.addIndexChange(builder);
View Full Code Here

            assertNotNull("parent join is null", iTable.getParentJoin());
            assertSame("parent join", oTable.getChildJoins().get(0), iTable.getParentJoin());
            assertEquals("child joins.size", 0, iTable.getChildJoins().size());
        }
        {
            Group group = cTable.getGroup();
            assertSame("o's group", group, oTable.getGroup());
            assertSame("i's group", group, iTable.getGroup());
        }

        return new TableIds(cId, oId, iId);
View Full Code Here

TOP

Related Classes of com.foundationdb.ais.model.Group

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.