Giter Site home page Giter Site logo

shmdb's Introduction

# shmdb 
A memory database based on  shared memory.

## 1. can do 
shmdb shared memory multi-process aimed at resolving the problem. Under linux or windows, operating system provides a shared memory feature, you can apply for a memory area by calling the system function, shmdb is the use of this feature of the operating system, the framework of a key-value type of database. When used to set up a pair of key-value through the function `shmdb_put`, also to get a pair of key-value through the function `shmdb_get`. 

## 2. can not do 
shmdb does not provide network access functions can only be embedded into applications to run. It is not suitable for network databases. 

## 3.API 

### 3.1 shmdb_initParent parent process initializes 

	int shmdb_initParent (STHashShareHandle * handle, unsigned int size) 

 **Parameters**  

- [In | out] `STHashShareHandle * handle`	`shmid`,which is the   member variable of `handle` will ben initialize in this function  
- `unsigned int size` specified base area 

 **The return value** 

- int result of the operation 

### 3.2 shmdb_initChild child process initialization 

	int shmdb_initChild (STHashShareHandle * handle) 
 **Parameters**  
   
- [In] `STHashShareHandle * handle` internal memory function to mount its own memory area based to the shared memory via the `handle`'s `shmid`    
 
 **The return value** 

- `int` result of the operation 

### 3.3 shmdb_put write value 

	int shmdb_put (STHashShareHandle * handle, const char * key, unsigned short keyLen, 
	const char * value, unsigned short valueLen) 

 **Parameters**   


- [In] `STHashShareHandle * handle` internal function to read the value of handle's shmid to manipulate shared memory     
- [In] `const char * key`   
- `unsigned short keyLen`  
- [In] `const char * value`  
- `unsigned short valueLen`  


 **The return value**  

- `int` result of the operation 

### 3.4 shmdb_get get the value 

	shmdb_get (STHashShareHandle * handle, const char * key, unsigned short keyLen, 
	char ** value, unsigned short * valueLen) 

 **Parameters**   

- [In] `STHashShareHandle * handle` internal function to read the value of handle's shmid to manipulate shared memory   
- [In] `const char * key`   
- `unsigned short keyLen`   
- [Out] `char ** value` internal function allocate the memory space of `value`, manually call the `free` function after this call is completed. If `valueLen` value is NULL, the function does not allocate the space of  `value`.   
- `unsigned short * valueLen `

 **The return value**  

- `int` result of the operation 

### 3.5 shmdb_delete delete values 

	int shmdb_delete (STHashShareHandle * handle, const char * key, unsigned short keyLen, 
	char ** value, unsigned short * valueLen) 

 **Parameters**  

- [In] `STHashShareHandle * handle` internal function to read the value of handle's shmid to manipulate shared memory   
- [In] `const char * key`   
- `unsigned short keyLen`   
- [Out] `char ** value` internal function allocate the memory space of `value`, manually call the `free` function after this call is completed. If `valueLen` value is NULL, the function does not allocate the space of  `value`.   
- `unsigned short * valueLen` 

 **The return value**  

- `int` result of the operation 
### 3.6 shmdb_destroy destruction 
> When the program exits normally, you should call this function manually to remove the shared memory from the operating system. 

	int shmdb_destroy (STHashShareHandle * handle) 

 **Parameters**  

- [In] `STHashShareHandle * handle` internal function to read the value of handle's shmid to manipulate shared memory 


 **The return value** 

- `int` result of the operation

## Contributors
[yunnysunny](https://github.com/yunnysunny) (maintainer)

**License:** [Apache License, Version 2.0](http://www.apache.org/licenses/LICENSE-2.0.html)

shmdb's People

Contributors

yunnysunny avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.