File: container.rd

package info (click to toggle)
libdb2-ruby 0.5.4-1
  • links: PTS
  • area: main
  • in suites: sarge
  • size: 2,352 kB
  • ctags: 2,743
  • sloc: ansic: 11,156; ruby: 6,199; cpp: 6,064; makefile: 86; sh: 31
file content (212 lines) | stat: -rw-r--r-- 5,573 bytes parent folder | download | duplicates (11)
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
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
=begin

== BDB::XML::Container

The container name provides the base for the filenames of the database
files used to store the container content. The directory within which
the files are opened is taken from the environment passed through the
Container constructor.  If no environment was provided, then the
directory used will be the current working directory.

# module BDB
# module XML
# class Container
# include Enumerable
# class << self

=== Class Methods

--- allocate(name = nil, options = {})

    allocate a new Container object

    : ((|name|))
      the name of the container

    : ((|options|))
      Hash with the possible keys

      : ((|env|))
        the Berkeley DB environment within which all database
        operations are to be performed.

      : ((|txn|))
        the transaction within which all database
        operations are to be performed.

      : ((|set_pagesize|))
        Set the pagesize of the primary database (512 < size < 64K)

--- dump(name, filename)
    Dump the container ((|name|)) into the specified file.

--- load(name, filename)
    Load data from the specified file into the container ((|name|))

--- remove(name)
    Remove the container ((|name|))

--- rename(name, newname)
    Rename the container ((|name|))

--- salvage(name, filename, flags = 0)
    Verify the container ((|name|)), and save the content in ((|filename|))

    : ((|flags|))
      flags can has the value ((|BDB::AGGRESSIVE|))

--- set_name(name, str)
    Set the name for the container ((|name|)). The underlying files for the
    container are not renamed - for that, see ((|Container::rename|))

--- verify(name)
    Verify the container ((|name|))


# end

=== Methods

--- close(flags = 0)
    close an open container

    : ((|flags|))
      flags can has the value 0 or ((|BDB::NOSYNC|))

--- delete(document, flags = 0)
    Remove the document from the container

    : ((|document|))
      document can be an ID or an ((|BDB::XML::Document|)) previously stored

    : ((|flags|))
      flags can has the value 0 or ((|BDB::AUTO_COMMIT|))

--- environment
--- env
    return the current environment for the container, or ((|nil|))

--- environment?
--- env?
    return ((|true|)) if the container was opend in an environment

--- each {|doc| ... }
    Iterate over all documents

--- self[id]
--- get(id, flags = 0)
    Fetch the document from the container

    : ((|id|))
      the id assigned to the document when it was first added to a container

    : ((|flags|))
      flags can has the value 0 or ((|BDB::DIRTY_READ|)), ((|BDB::RMW|))

--- self[id] = document
    Replace the document (see also #update)

--- index=(index)
    set the indexing : ((|index|)) must be an ((|BDB::XML::Index|)) object

--- index
    Retrieve the ((|BDB::XML::Index|))

    Return ((|nil|)) if no indexing was specified

--- initialize(name, flags = 0, mode = 0)
    open the container

    : ((|name|))
      see ((|allocate|))

    : ((|flags|))
      The flags must be the string "r", "r+", "w", "w+", "a", "a+" or
      and integer value.

    : ((|mode|))
      mode for creation (see chmod(2))

--- modify(mod, context = nil, flags = 0)
    in-place modification of all documents according to the state of the 
    ((|BDB::XML::Modify|)) object, which contains an XPath expression to 
    target document nodes, as well as specification of the modifications 
    to perform

    ((|context|)) is an optional ((|BDB::XML::Context|)) used for the update
    operations on the container.

    ((|flags|)) must be set to zero or ((|BDB::RMW|)) to acquire a write lock

--- name
    return the name of the container

--- name=(str)
    Set the name of the container. Can be called only on a closed container
    See also ((|Container::set_name|))

--- open?
    return ((|true|)) if the container is open

--- parse(query, context = nil)
    Pre-parse an XPath query and return an ((|BDB::XML::XPath|)) object

    : ((|query|))
      the XPath query to execute against the container

    : ((|context|))
      the context within which the query will be executed

--- push(document, flags = 0)
    Add a document to the container and return an ID

    : ((|document|))
      an object ((|BDB::XML::Document|)) or any object suitable for 
      ((|BDB::XML::Document::new|))

    : ((|flags|))
      flags can be 0 or ((|BDB::AUTO_COMMIT|))

--- <<(document)
    Add a document to the container and return ((|self|))

--- query(xpath, flags = 0)
--- query(string, context, flags = 0)
    Query the container with an XPath expression, which can be an object
    ((|BDB::XML::XPath|)) or a ((|String|))

    : ((|flags|))
      flags can have the value 0 or ((|BDB::DIRTY_READ|)), ((|BDB::RMW|))

    return a ((|BDB::XML::Results|)) object

--- search(xpath, returntype = BDB::XML::Context::Document) {|doc| ... }
    Iterate over the result of a query

    ((|returntype|)) can have the values ((|BDB::XML::Context::Document|))
    or ((|BDB::XML::Context::Values|))

    the query is evaluated lazily

--- transaction
    return the transaction associated with the container, or ((|nil|))

--- in_transaction?
--- transaction?
    return ((|true|)) if the container is associated with a transaction

--- update(document)
    Update a document within the container

--- update_context {|cxt| ... }
--- context {|cxt| ... }
    return an ((|BDB::XML::UpdateContext|)) which can be used to perform
    ((|[]|)), ((|[]=|)), ((|push|)), ((|delete|)), ((|update|)) operation
    
    This can be used for a performance improvement
 
# end
# end
# end

=end