RDBMS上的NoSQL / KeyValue抽象?

时间:2013-12-06 19:10:11

标签: java nosql rdbms key-value-store

我的任务是找出一种方法来实现NoSQL / KeyValue-esque抽象层(作为Java接口或REST接口),它使用Oracle RDBMS作为数据存储。这样做的原因包括必须处理遗留的基础架构,这些基础架构不会很快消失,并且为开发人员提供了使用基本CRUD功能快速构建应用程序原型的能力。

约束:现有的Oracle RDBMS实例需要是数据存储。

我正在考虑建立自己的Java界面来实现这一点,但我担心我可能会重新发明轮子。有没有我应该看的Java库?

这是一个关于API的消费者界面可能是什么样子的稻草人设计:

public interface KeyValueStore {
    /**
     * this would create a new Oracle table in a predefined schema
     * @param dbName
     * @return
     */
    DB create(String dbName);

    /**
     * Store a simple Map<> for the given entity with the given identity (maybe primary key)
     * Perhaps encode properties as a JSON string and store it as a BLOB in a column?
     * 
     * @param db
     * @param entity
     * @param identity
     * @param properties
     */
    void save(DB db, String entity, String identity, Map<String, String> properties);

    /**
     * Retrieve an entity with the specified identity
     * 
     * @param db
     * @param entity
     * @param identity
     * @return
     */
    Map<String, String> get(DB db, String entity, String identity);

    public interface DB {
        String getName();
        // add more methods here
    }
}

1 个答案:

答案 0 :(得分:0)

我已经创作并开源了一个Java实现,它提供了一个基于RDBMS的NoSQL抽象,可以将实体存储为无模式的属性包(例如,JSON对象或Java Maps)。实体具有GUID并且可以具有多个版本。就数据存储而言,实体的其余部分是不透明的。从服务使用者的角度来看,只需存储新属性即可更改数据存储区的“模式”。

https://github.com/akamai/Entity-Persistence-Service

请参阅http://backchannel.org/blog/friendfeed-schemaless-mysql获取技术灵感。

相关问题