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


Java Encoder.compressAndBase64Encode方法代码示例

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


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

示例1: writePlanBytes

import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
/**
 * Update the plan fragment and return the bytes of the plan
 */
static byte[] writePlanBytes(VoltCompiler compiler, PlanFragment fragment, AbstractPlanNode planGraph)
throws VoltCompilerException {
    // get the plan bytes
    PlanNodeList node_list = new PlanNodeList(planGraph);
    String json = node_list.toJSONString();
    compiler.captureDiagnosticJsonFragment(json);
    // Place serialized version of PlanNodeTree into a PlanFragment
    byte[] jsonBytes = json.getBytes(Charsets.UTF_8);
    String bin64String = Encoder.compressAndBase64Encode(jsonBytes);
    fragment.setPlannodetree(bin64String);
    return jsonBytes;
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:16,代码来源:StatementCompiler.java

示例2: compileToCatalog

import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
public void compileToCatalog(Database db) throws VoltCompilerException {
    // note this will need to be decompressed to be used
    String binDDL = Encoder.compressAndBase64Encode(m_fullDDL);
    db.setSchema(binDDL);

    // output the xml catalog to disk
    BuildDirectoryUtils.writeFile("schema-xml", "hsql-catalog-output.xml", m_schema.toString(), true);

    // build the local catalog from the xml catalog
    fillCatalogFromXML(db, m_schema);
    fillTrackerFromXML();
}
 
开发者ID:anhnv-3991,项目名称:VoltDB,代码行数:13,代码来源:DDLCompiler.java

示例3: prepareApplicationCatalogDiff

import org.voltdb.utils.Encoder; //导入方法依赖的package包/类
private AsyncCompilerResult prepareApplicationCatalogDiff(CatalogChangeWork work) {
        // create the change result and set up all the boiler plate
        CatalogChangeResult retval = new CatalogChangeResult();
//        retval.clientData = work.clientData;
        retval.clientHandle = work.clientHandle;
//        retval.connectionId = work.connectionId;
//        retval.hostname = work.hostname;

        // catalog change specific boiler plate
        retval.catalogURL = work.catalogURL;

        // get the diff between catalogs
        try {
            // try to get the new catalog from the params
            String newCatalogCommands = CatalogUtil.loadCatalogFromJar(work.catalogURL, null);
            if (newCatalogCommands == null) {
                retval.errorMsg = "Unable to read from catalog at: " + work.catalogURL;
                return retval;
            }
            Catalog newCatalog = new Catalog();
            newCatalog.execute(newCatalogCommands);

            // get the current catalog
            CatalogContext context = VoltDB.instance().getCatalogContext();

            // store the version of the catalog the diffs were created against.
            // verified when / if the update procedure runs in order to verify
            // catalogs only move forward
            retval.expectedCatalogVersion = context.catalog.getCatalogVersion();

            // compute the diff in StringBuilder
            CatalogDiffEngine diff = new CatalogDiffEngine(context.catalog, newCatalog);
            if (!diff.supported()) {
                throw new Exception("The requested catalog change is not a supported change at this time. " + diff.errors());
            }

            // since diff commands can be stupidly big, compress them here
            retval.encodedDiffCommands = Encoder.compressAndBase64Encode(diff.commands());
            // check if the resulting string is small enough to fit in our parameter sets (about 2mb)
            if (retval.encodedDiffCommands.length() > (2 * 1000 * 1000)) {
                throw new Exception("The requested catalog change is too large for this version of VoltDB. " +
                                    "Try a series of smaller updates.");
            }
        }
        catch (Exception e) {
            e.printStackTrace();
            retval.encodedDiffCommands = null;
            retval.errorMsg = e.getMessage();
        }

        return retval;
    }
 
开发者ID:s-store,项目名称:sstore-soft,代码行数:53,代码来源:AsyncCompilerWorkThread.java


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