func (dm *DMap) GetPut(key string, value interface{}) (interface{}, error) {
	prev, err := dm.dm.GetPut(key, value)
	if err != nil {
		return nil, convertDMapError(err)
	}
	return prev, nil
}
GetPut atomically sets key to value and returns the old value stored at key.
package olric
import (
	"errors"
	"time"
	"github.com/buraksezer/olric/internal/dmap"
	"github.com/buraksezer/olric/query"
)
const (
	IfNotFound = int16(1) << iota
	IfFound
)
var (
	ErrKeyNotFound = errors.New("key not found")
	ErrKeyFound = errors.New("key found")
	ErrWriteQuorum = errors.New("write quorum cannot be reached")
	ErrReadQuorum = errors.New("read quorum cannot be reached")
	ErrLockNotAcquired = errors.New("lock not acquired")
	ErrNoSuchLock = errors.New("no such lock")
	ErrEndOfQuery = errors.New("end of query")
	ErrClusterQuorum = errors.New("cannot be reached cluster quorum to operate")
	ErrKeyTooLarge = errors.New("key too large")
)
const NumConcurrentWorkers = 2
type QueryResponse map[string]interface{}
func convertDMapError(err error) error {
	switch {
	case errors.Is(err, dmap.ErrKeyFound):
		return ErrKeyFound
	case errors.Is(err, dmap.ErrKeyNotFound):
		return ErrKeyNotFound
	case errors.Is(err, dmap.ErrDMapNotFound):
		return ErrKeyNotFound
	case errors.Is(err, dmap.ErrEndOfQuery):
		return ErrEndOfQuery
	case errors.Is(err, dmap.ErrLockNotAcquired):
		return ErrLockNotAcquired
	case errors.Is(err, dmap.ErrNoSuchLock):
		return ErrNoSuchLock
	case errors.Is(err, dmap.ErrReadQuorum):
		return ErrReadQuorum
	case errors.Is(err, dmap.ErrWriteQuorum):
		return ErrWriteQuorum
	case errors.Is(err, dmap.ErrServerGone):
		return ErrServerGone
	default:
		return convertClusterError(err)
	}
}
type Entry struct {
	Key       string
	Value     interface{}
	TTL       int64
	Timestamp int64
}
type LockContext struct {
	ctx *dmap.LockContext
}
type Cursor struct {
	cursor *dmap.Cursor
}
type DMap struct {
	dm *dmap.DMap
}
func (db *Olric) NewDMap(name string) (*DMap, error) {
	dm, err := db.dmap.NewDMap(name)
	if err != nil {
		return nil, convertDMapError(err)
	}
	return &DMap{
		dm: dm,
	}, nil
}
func (dm *DMap) Name() string {
	return dm.dm.Name()
}
func (dm *DMap) Get(key string) (interface{}, error) {
	value, err := dm.dm.Get(key)
	if err != nil {
		return nil, convertDMapError(err)
	}
	return value, nil
}
func (dm *DMap) GetEntry(key string) (*Entry, error) {
	e, err := dm.dm.GetEntry(key)
	if err != nil {
		return nil, convertDMapError(err)
	}
	return &Entry{
		Key:       e.Key,
		Value:     e.Value,
		TTL:       e.TTL,
		Timestamp: e.Timestamp,
	}, nil
}
func (dm *DMap) LockWithTimeout(key string, timeout, deadline time.Duration) (*LockContext, error) {
	ctx, err := dm.dm.LockWithTimeout(key, timeout, deadline)
	if err != nil {
		return nil, convertDMapError(err)
	}
	return &LockContext{ctx: ctx}, nil
}
func (dm *DMap) Lock(key string, deadline time.Duration) (*LockContext, error) {
	ctx, err := dm.dm.Lock(key, deadline)
	if err != nil {
		return nil, convertDMapError(err)
	}
	return &LockContext{ctx: ctx}, nil
}
func (l *LockContext) Unlock() error {
	err := l.ctx.Unlock()
	return convertDMapError(err)
}
func (dm *DMap) PutEx(key string, value interface{}, timeout time.Duration) error {
	err := dm.dm.PutEx(key, value, timeout)
	return convertDMapError(err)
}
func (dm *DMap) Put(key string, value interface{}) error {
	err := dm.dm.Put(key, value)
	return convertDMapError(err)
}
func (dm *DMap) PutIf(key string, value interface{}, flags int16) error {
	err := dm.dm.PutIf(key, value, flags)
	return convertDMapError(err)
}
func (dm *DMap) PutIfEx(key string, value interface{}, timeout time.Duration, flags int16) error {
	err := dm.dm.PutIfEx(key, value, timeout, flags)
	return convertDMapError(err)
}
func (dm *DMap) Expire(key string, timeout time.Duration) error {
	err := dm.dm.Expire(key, timeout)
	return convertDMapError(err)
}
func (dm *DMap) Query(q query.M) (*Cursor, error) {
	c, err := dm.dm.Query(q)
	if err != nil {
		return nil, convertDMapError(err)
	}
	return &Cursor{cursor: c}, nil
}
func (c *Cursor) Range(f func(key string, value interface{}) bool) error {
	err := c.cursor.Range(f)
	return convertDMapError(err)
}
func (c *Cursor) Close() {
	c.cursor.Close()
}
func (dm *DMap) Delete(key string) error {
	err := dm.dm.Delete(key)
	return convertDMapError(err)
}
func (dm *DMap) Incr(key string, delta int) (int, error) {
	value, err := dm.dm.Incr(key, delta)
	if err != nil {
		return 0, convertDMapError(err)
	}
	return value, nil
}
func (dm *DMap) Decr(key string, delta int) (int, error) {
	value, err := dm.dm.Decr(key, delta)
	if err != nil {
		return 0, convertDMapError(err)
	}
	return value, nil
}