• STSdb,最强纯C#开源NoSQL和虚拟文件系统 4.0 RC2 支持C/S架构


    STSdb是什么

    再来说明一下STSdb是什么:STSdb是C#写的开源嵌入式数据库和虚拟文件系统,支持实时索引,性能是同类产品的几倍到几十倍,访问官方网站

    温故知新

    之前发了文章《STSdb,最强纯C#开源NoSQL和虚拟文件系统》,相信大家对Waterfall-tree(瀑布树)算法还是有兴趣的。

    不兼容改动

     为了提供更易容的API和更好的性能,STSdb 4.0 RC2改变了文件格式,这个改变可能会持续,直到4.0正式版。

    C/S架构

    在上一篇文章,提及会在4.0正式版之前加入对C/S的支持,现在在RC2已经引入。

    客户端

    //客户端,创建一个连接:
    using (IStorageEngine engine = STSdb.FromNetwork(host, port))
    {
    }
    

    服务器端

    //服务器端,启动一个服务器实例
    using (IStorageEngine engine = STSdb.FromFile("stsdb4.sys", "stsdb4.dat"))
    {
        var server = STSdb.CreateServer(engine, port);
        server.Start();
        //服务器端已经启动,可以接受客户端请求
        server.Stop();
    }
    

    DataType类型

    DataType类型用于描述非泛型的IIndex和IData数据类型

    //以前的做法
    XIndex<IData, IData> table = engine.OpenXIndex(typeof(Data<int>), typeof(Data<string>), "table");
    //新做法
    IIndex<IData, IData> table = engine.OpenXIndex(DataType.Int32, DataType.String, "table");
    

      

    //以前的做法
    XIndex<IData, IData> table = engine.OpenXIndex(typeof(Data<long>), typeof(Data<string, DateTime, double, double, long, string>), "table");
    //新做法
    DataType keyType = DataType.Int64;
    DataType recordType = DataType.Slotes(
        DataType.String,
        DataType.DateTime,
        DataType.Double,
        DataType.Double,
        DataType.Int64,
        DataType.String
    );
    IIndex<IData, IData> table = engine.OpenXIndex(keyType, recordType, "table");
    

     

    公有字段

    IIndex现在支持公有字段的读写

    List<T>, T[]和Dictionary

    在4.0 RC2仍然不支持,但会在4.0 Final支持

    下载

    点击这里下载源代码

  • 相关阅读:
    我爱Java系列之---【SpringBoot打成war包部署】
    279. Perfect Squares
    矩阵dfs--走回路
    112. Path Sum
    542. 01 Matrix
    106. Construct Binary Tree from Inorder and Postorder Traversal
    105. Construct Binary Tree from Preorder and Inorder Traversal
    Invert Binary Tree
    563 Binary Tree Tilt
    145 Binary Tree Postorder Traversal
  • 原文地址:https://www.cnblogs.com/unruledboy/p/stsdb40rc2.html
Copyright © 2020-2023  润新知