当前位置: 首页>>代码示例>>Java>>正文


Java Schema.isSystemKeyspace方法代码示例

本文整理汇总了Java中org.apache.cassandra.config.Schema.isSystemKeyspace方法的典型用法代码示例。如果您正苦于以下问题:Java Schema.isSystemKeyspace方法的具体用法?Java Schema.isSystemKeyspace怎么用?Java Schema.isSystemKeyspace使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在org.apache.cassandra.config.Schema的用法示例。


在下文中一共展示了Schema.isSystemKeyspace方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: validate

import org.apache.cassandra.config.Schema; //导入方法依赖的package包/类
public void validate(ClientState state) throws RequestValidationException
{
    KeyspaceMetadata ksm = Schema.instance.getKSMetaData(name);
    if (ksm == null)
        throw new InvalidRequestException("Unknown keyspace " + name);
    if (Schema.isSystemKeyspace(ksm.name))
        throw new InvalidRequestException("Cannot alter system keyspace");

    attrs.validate();

    if (attrs.getReplicationStrategyClass() == null && !attrs.getReplicationOptions().isEmpty())
        throw new ConfigurationException("Missing replication strategy class");

    if (attrs.getReplicationStrategyClass() != null)
    {
        // The strategy is validated through KSMetaData.validate() in announceKeyspaceUpdate below.
        // However, for backward compatibility with thrift, this doesn't validate unexpected options yet,
        // so doing proper validation here.
        KeyspaceParams params = attrs.asAlteredKeyspaceParams(ksm.params);
        params.validate(name);
        if (params.replication.klass.equals(LocalStrategy.class))
            throw new ConfigurationException("Unable to use given strategy class: LocalStrategy is reserved for internal use.");
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:25,代码来源:AlterKeyspaceStatement.java

示例2: trueSnapshotsSize

import org.apache.cassandra.config.Schema; //导入方法依赖的package包/类
public long trueSnapshotsSize()
{
    long total = 0;
    for (Keyspace keyspace : Keyspace.all())
    {
        if (Schema.isSystemKeyspace(keyspace.getName()))
            continue;

        for (ColumnFamilyStore cfStore : keyspace.getColumnFamilyStores())
        {
            total += cfStore.trueSnapshotsSize();
        }
    }

    return total;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:17,代码来源:StorageService.java

示例3: preventSystemKSSchemaModification

import org.apache.cassandra.config.Schema; //导入方法依赖的package包/类
private void preventSystemKSSchemaModification(String keyspace, DataResource resource, Permission perm) throws UnauthorizedException
{
    // we only care about schema modification.
    if (!((perm == Permission.ALTER) || (perm == Permission.DROP) || (perm == Permission.CREATE)))
        return;

    // prevent system keyspace modification
    if (Schema.isSystemKeyspace(keyspace))
        throw new UnauthorizedException(keyspace + " keyspace is not user-modifiable.");

    // allow users with sufficient privileges to alter KS level options on AUTH_KS and
    // TRACING_KS, and also to drop legacy tables (users, credentials, permissions) from
    // AUTH_KS
    if (ALTERABLE_SYSTEM_KEYSPACES.contains(resource.getKeyspace().toLowerCase())
       && ((perm == Permission.ALTER && !resource.isKeyspaceLevel())
           || (perm == Permission.DROP && !DROPPABLE_SYSTEM_TABLES.contains(resource))))
    {
        throw new UnauthorizedException(String.format("Cannot %s %s", perm, resource));
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:21,代码来源:ClientState.java

示例4: execute

import org.apache.cassandra.config.Schema; //导入方法依赖的package包/类
@Override
public void execute(NodeProbe probe)
{
    List<String> keyspaces = parseOptionalKeyspace(args, probe, KeyspaceSet.NON_LOCAL_STRATEGY);
    String[] tableNames = parseOptionalTables(args);

    for (String keyspace : keyspaces)
    {
        if (Schema.isSystemKeyspace(keyspace))
            continue;

        try
        {
            probe.forceKeyspaceCleanup(System.out, jobs, keyspace, tableNames);
        }
        catch (Exception e)
        {
            throw new RuntimeException("Error occurred during cleanup", e);
        }
    }
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:22,代码来源:Cleanup.java

示例5: forceKeyspaceCleanup

import org.apache.cassandra.config.Schema; //导入方法依赖的package包/类
public int forceKeyspaceCleanup(int jobs, String keyspaceName, String... tables) throws IOException, ExecutionException, InterruptedException
{
    if (Schema.isSystemKeyspace(keyspaceName))
        throw new RuntimeException("Cleanup of the system keyspace is neither necessary nor wise");

    CompactionManager.AllSSTableOpStatus status = CompactionManager.AllSSTableOpStatus.SUCCESSFUL;
    for (ColumnFamilyStore cfStore : getValidColumnFamilies(false, false, keyspaceName, tables))
    {
        CompactionManager.AllSSTableOpStatus oneStatus = cfStore.forceCleanup(jobs);
        if (oneStatus != CompactionManager.AllSSTableOpStatus.SUCCESSFUL)
            status = oneStatus;
    }
    return status.statusCode;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:15,代码来源:StorageService.java

示例6: systemKeyspaceQuery

import org.apache.cassandra.config.Schema; //导入方法依赖的package包/类
private static boolean systemKeyspaceQuery(List<? extends ReadCommand> cmds)
{
    for (ReadCommand cmd : cmds)
        if (!Schema.isSystemKeyspace(cmd.metadata().ksName))
            return false;
    return true;
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:8,代码来源:StorageProxy.java

示例7: ensureReadMeter

import org.apache.cassandra.config.Schema; //导入方法依赖的package包/类
void ensureReadMeter()
{
    if (readMeter != null)
        return;

    // Don't track read rates for tables in the system keyspace and don't bother trying to load or persist
    // the read meter when in client mode.
    if (Schema.isSystemKeyspace(desc.ksname))
    {
        readMeter = null;
        readMeterSyncFuture = NULL;
        return;
    }

    readMeter = SystemKeyspace.getSSTableReadMeter(desc.ksname, desc.cfname, desc.generation);
    // sync the average read rate to system.sstable_activity every five minutes, starting one minute from now
    readMeterSyncFuture = new WeakReference<>(syncExecutor.scheduleAtFixedRate(new Runnable()
    {
        public void run()
        {
            if (obsoletion == null)
            {
                meterSyncThrottle.acquire();
                SystemKeyspace.persistSSTableReadMeter(desc.ksname, desc.cfname, desc.generation, readMeter);
            }
        }
    }, 1, 5, TimeUnit.MINUTES));
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:29,代码来源:SSTableReader.java

示例8: validateKeyspaceNotSystem

import org.apache.cassandra.config.Schema; //导入方法依赖的package包/类
public static void validateKeyspaceNotSystem(String modifiedKeyspace) throws org.apache.cassandra.exceptions.InvalidRequestException
{
    if (Schema.isSystemKeyspace(modifiedKeyspace))
        throw new org.apache.cassandra.exceptions.InvalidRequestException(String.format("%s keyspace is not user-modifiable", modifiedKeyspace));
}
 
开发者ID:scylladb,项目名称:scylla-tools-java,代码行数:6,代码来源:ThriftValidation.java


注:本文中的org.apache.cassandra.config.Schema.isSystemKeyspace方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。