flatfile.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748
  1. /*
  2. +----------------------------------------------------------------------+
  3. | PHP Version 5 |
  4. +----------------------------------------------------------------------+
  5. | Copyright (c) 1997-2016 The PHP Group |
  6. +----------------------------------------------------------------------+
  7. | This source file is subject to version 3.01 of the PHP license, |
  8. | that is bundled with this package in the file LICENSE, and is |
  9. | available through the world-wide-web at the following url: |
  10. | http://www.php.net/license/3_01.txt |
  11. | If you did not receive a copy of the PHP license and are unable to |
  12. | obtain it through the world-wide-web, please send a note to |
  13. | license@php.net so we can mail you a copy immediately. |
  14. +----------------------------------------------------------------------+
  15. | Author: Marcus Boerger <helly@php.net> |
  16. +----------------------------------------------------------------------+
  17. */
  18. /* $Id$ */
  19. #ifndef PHP_LIB_FLATFILE_H
  20. #define PHP_LIB_FLATFILE_H
  21. typedef struct {
  22. char *dptr;
  23. size_t dsize;
  24. } datum;
  25. typedef struct {
  26. char *lockfn;
  27. int lockfd;
  28. php_stream *fp;
  29. size_t CurrentFlatFilePos;
  30. datum nextkey;
  31. } flatfile;
  32. #define FLATFILE_INSERT 1
  33. #define FLATFILE_REPLACE 0
  34. int flatfile_store(flatfile *dba, datum key_datum, datum value_datum, int mode TSRMLS_DC);
  35. datum flatfile_fetch(flatfile *dba, datum key_datum TSRMLS_DC);
  36. int flatfile_delete(flatfile *dba, datum key_datum TSRMLS_DC);
  37. int flatfile_findkey(flatfile *dba, datum key_datum TSRMLS_DC);
  38. datum flatfile_firstkey(flatfile *dba TSRMLS_DC);
  39. datum flatfile_nextkey(flatfile *dba TSRMLS_DC);
  40. char *flatfile_version();
  41. #endif