File: interfaces.py

package info (click to toggle)
py-lmdb 1.4.1-3
  • links: PTS, VCS
  • area: main
  • in suites: forky, sid, trixie
  • size: 1,832 kB
  • sloc: ansic: 11,932; python: 4,646; makefile: 128
file content (125 lines) | stat: -rw-r--r-- 3,147 bytes parent folder | download | duplicates (3)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125

from __future__ import absolute_import
import zope.interface


class IKeyStoreSync(zope.interface.Interface):
    def get(key):
        """
        Fetch a key
        @return None or bytestring value.
        """

    def put(key, value):
        """
        Create or overwrite a key.
        @param key Bytestring key.
        @param value Bytestring alue.
        @return deferred producing None or error.
        """

    def delete(key):
        """
        Delete a key.
        @param key Bytestring key.
        @return deferred producing None or error.
        """

    def seek(key):
        """
        Seek to a key, or the next highest key.
        @param key Bytestring key.
        """

    def first():
        """
        Seek to the first key in the store.
        @return True if positioned on a key.
        """

    def last():
        """
        Seek to the last key in the store.
        @return True if positioned on a key.
        """

    def next():
        """
        Seek to the next key in the store.
        @return True if positioned on a key.
        """

    def prev():
        """
        Seek to the previous key in the store.
        @return True if positioned on a key.
        """


class IKeyStore(zope.interface.Interface):
    def get(key):
        """
        Fetch a key.
        @return deferred producing None or bytestring value.
        """

    def getKeys(key, count):
        """
        Fetch a list of keys.
        @param key
            Bytestring first key to return, or None for first/last key
            in space.
        @param count Number of keys including first key to return.
        """

    def getKeysReverse(key, count):
        """
        Fetch a list of keys, walking in reverse.
        @param key
            Bytestring first key to return, or None for first/last key
            in space.
        @param count Number of keys including first key to return.
        """

    def getItems(key, count):
        """
        Fetch a list of (key, value) tuples.
        @param key
            Bytestring first key to return, or None for first/last key
            in space.
        @param count Number of keys including first key to return.
        """

    def getItemsReverse(key, count):
        """
        Fetch a list of (key, value) tuples.
        @param key
            Bytestring first key to return, or None for first/last key
            in space.
        @param count Number of keys including first key to return.
        """

    def put(key):
        """
        Create or overwrite a key.

        @param key Bytestring key.
        @param value Bytestring alue.
        @return deferred producing None or error.
        """

    def delete(key):
        """
        Delete a key.
        @param key Bytestring key.
        @return deferred producing None or error.
        """

    def putGroup(func):
        """
        Execute a function in the context of synchronous (IKeyStoreSync)
        transaction, in a private thread.

        @param func Function accepting IKeyStoreSync parameter.
        @returns deferred producing None or error.
        """