Class BaseKdDao

  • All Implemented Interfaces:
    IKdStorage, java.lang.AutoCloseable

    public class BaseKdDao
    extends BaseNoSqlDao
    implements IKdStorage
    Base class for {key:document} NoSQL-based DAOs.
    Since:
    0.10.0
    Author:
    Thanh Nguyen
    • Constructor Detail

      • BaseKdDao

        public BaseKdDao()
    • Method Detail

      • delete

        public void delete​(java.lang.String spaceId,
                           java.lang.String key,
                           IDeleteCallback callback)
                    throws java.io.IOException
        Delete an existing entry from storage.
        Specified by:
        delete in interface IKdStorage
        Throws:
        java.io.IOException
      • keyExists

        public boolean keyExists​(java.lang.String spaceId,
                                 java.lang.String key)
                          throws java.io.IOException
        Check if a key exists.
        Specified by:
        keyExists in interface IKdStorage
        Returns:
        Throws:
        java.io.IOException
      • get

        public java.util.Map<java.lang.String,​java.lang.Object> get​(java.lang.String spaceId,
                                                                          java.lang.String key)
                                                                   throws java.io.IOException
        Get/Load an entry by key.
        Specified by:
        get in interface IKdStorage
        Returns:
        Throws:
        java.io.IOException
      • get

        public <T> T get​(IKdEntryMapper<T> mapper,
                         java.lang.String spaceId,
                         java.lang.String key)
                  throws java.io.IOException
        Get/Load an entry by key.
        Specified by:
        get in interface IKdStorage
        Returns:
        Throws:
        java.io.IOException
      • put

        public void put​(java.lang.String spaceId,
                        java.lang.String key,
                        java.util.Map<java.lang.String,​java.lang.Object> document,
                        IPutCallback<java.util.Map<java.lang.String,​java.lang.Object>> callback)
                 throws java.io.IOException
        Put/Store an entry.
        Specified by:
        put in interface IKdStorage
        Throws:
        java.io.IOException
      • size

        public long size​(java.lang.String spaceId)
                  throws java.io.IOException
        Return number of entries.
        Specified by:
        size in interface IKdStorage
        Returns:
        number of entries currently in the storage, -1 if counting number entries is not supported
        Throws:
        java.io.IOException