summaryrefslogtreecommitdiff
path: root/src/third_party/wiredtiger/lang
diff options
context:
space:
mode:
authorLuke Chen <luke.chen@mongodb.com>2018-12-05 16:00:08 +1100
committerLuke Chen <luke.chen@mongodb.com>2018-12-05 16:24:35 +1100
commitb74f8750d92f1dc31469261d8fbfe359ae759c29 (patch)
tree8c15b6c91170239c551f11a1e316fdb057bd83c0 /src/third_party/wiredtiger/lang
parent51ada5ef6dafa2ca29d329edb0a93fc1a91e2ad0 (diff)
downloadmongo-b74f8750d92f1dc31469261d8fbfe359ae759c29.tar.gz
Import wiredtiger: fcb59a43a44222716ddae6d94d45cdfd36b915f7 from branch mongodb-4.2
ref: 74aa2f92a9..fcb59a43a4 for: 4.1.7 WT-4192 Remove WiredTiger raw compression support WT-4319 Improvements to csuite tests WT-4331 Further extend max wait time for test_bug019.py WT-4393 Document cursor behaviour for read committed isolation WT-4410 Split 'unit-test' task to reduce Evergreen Ubuntu build variant runtime WT-4417 Make os_cache_max and os_cache_dirty_max reconfigurable WT-4421 Add a way to calculate modify operations WT-4434 Modify zstd compression level from 3 to 6 WT-4442 Add the ability to duplicate a backup cursor WT-4455 test_wt4156_metadata_salvage with HAVE_ATTACH fails on zSeries WT-4457 Add a maximum of dirty system buffers for the logging subsystem WT-4463 Reduce runtime for csuite handle locks testing WT-4464 In debug output row-store internal page keys may not format correctly WT-4469 Coverity #105148: redundant test
Diffstat (limited to 'src/third_party/wiredtiger/lang')
-rw-r--r--src/third_party/wiredtiger/lang/java/wiredtiger.i1
-rw-r--r--src/third_party/wiredtiger/lang/python/wiredtiger.i41
2 files changed, 41 insertions, 1 deletions
diff --git a/src/third_party/wiredtiger/lang/java/wiredtiger.i b/src/third_party/wiredtiger/lang/java/wiredtiger.i
index dfac0e9ec8d..5ef1658a322 100644
--- a/src/third_party/wiredtiger/lang/java/wiredtiger.i
+++ b/src/third_party/wiredtiger/lang/java/wiredtiger.i
@@ -357,6 +357,7 @@ WT_CLASS(struct __wt_async_op, WT_ASYNC_OP, op)
%ignore __wt_modify::position;
%ignore __wt_modify::size;
%ignore __wt_cursor::modify;
+%ignore wiredtiger_calc_modify;
%ignore __wt_cursor::compare(WT_CURSOR *, WT_CURSOR *, int *);
%rename (compare_wrap) __wt_cursor::compare;
diff --git a/src/third_party/wiredtiger/lang/python/wiredtiger.i b/src/third_party/wiredtiger/lang/python/wiredtiger.i
index 9ba6bd15c78..47ed727f3a8 100644
--- a/src/third_party/wiredtiger/lang/python/wiredtiger.i
+++ b/src/third_party/wiredtiger/lang/python/wiredtiger.i
@@ -151,6 +151,41 @@ from packing import pack, unpack
}
}
+%typemap(in,numinputs=1) (WT_MODIFY *entries, int *nentriesp) (WT_MODIFY *mod, int nentries) {
+ nentries = (int) PyLong_AsLong($input);
+ if (__wt_calloc_def(NULL, (size_t)nentries, &mod) != 0)
+ SWIG_exception_fail(SWIG_MemoryError, "WT calloc failed");
+ $1 = mod;
+ $2 = &nentries;
+}
+
+%typemap(argout) (WT_MODIFY *entries, int *nentriesp) {
+ int i;
+ $result = PyList_New(*$2);
+ for (i = 0; i < *$2; i++) {
+ PyObject *o = SWIG_NewPointerObj(Py_None, SWIGTYPE_p___wt_modify, 0);
+ PyObject_SetAttrString(o, "data", PyString_FromStringAndSize(
+ $1[i].data.data, $1[i].data.size));
+ PyObject_SetAttrString(o, "offset",
+ PyInt_FromLong($1[i].offset));
+ PyObject_SetAttrString(o, "size",
+ PyInt_FromLong($1[i].size));
+ PyList_SetItem($result, i, o);
+ }
+}
+
+%typemap(in) const WT_ITEM * (WT_ITEM val, long sz) {
+ if (PyString_AsStringAndSize($input, &val.data, &sz) < 0)
+ SWIG_exception_fail(SWIG_AttributeError,
+ "bad string value for WT_ITEM");
+ val.size = (size_t)sz;
+ $1 = &val;
+}
+
+%typemap(freearg) (WT_MODIFY *entries, int *nentriesp) {
+ __wt_free(NULL, $1);
+}
+
%typemap(in) WT_MODIFY * (int len, WT_MODIFY *modarray, int i) {
len = PyList_Size($input);
/*
@@ -209,7 +244,7 @@ from packing import pack, unpack
}
%typemap(freearg) WT_MODIFY * {
- /* The WT_MODIFY arg is in position 2. Is there a better way? */
+ /* The WT_MODIFY arg is in position 2. Is there a better way? */
WT_MODIFY *modarray = modarray2;
size_t i, len;
@@ -980,6 +1015,9 @@ typedef int int_void;
self.data = data
self.offset = offset
self.size = size
+
+ def __repr__(self):
+ return 'Modify(\'%s\', %d, %d)' % (self.data, self.offset, self.size)
%}
};
@@ -1008,6 +1046,7 @@ int diagnostic_build() {
#endif
}
%}
+
int diagnostic_build();
/* Remove / rename parts of the C API that we don't want in Python. */