Merge remote-tracking branch 'local-master/master' into modern-harvey2

modern-harvey2
Doug Coleman 2017-12-24 14:59:58 -08:00
commit 3d83bb9f06
40 changed files with 245 additions and 1636 deletions

View File

@ -19,7 +19,6 @@ addons:
packages:
- links
- libblas-dev
- libfftw3-dev
- libmagic-dev
- libsnappy-dev
- libzmq-dev
@ -36,7 +35,6 @@ before_install:
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew ls --versions redis > /dev/null || brew install redis; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew ls --versions zeromq > /dev/null || brew install zeromq; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew ls --versions postgresql > /dev/null || brew install postgresql; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew ls --versions fftw > /dev/null || brew install fftw; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew services start memcached; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew services start redis; fi
- if [[ "$TRAVIS_OS_NAME" == "osx" ]]; then brew services start postgresql; fi
@ -50,7 +48,7 @@ script: >
( echo "=== Factor Configure Postgresql ===" ; ./factor -e='USING: db.postgresql namespaces memory ; T{ postgresql-db f "localhost" f f f f "postgres" "" } \ postgresql-db set-global save' ; ret=$? ; echo "=== $ret ==="; [ $ret == 0 ] ) &&
( echo "=== Factor Configure Imap ===" ; ./factor -e='USING: imap namespaces memory environment accessors ; T{ imap-settings { host "imap.gmail.com" } } "FACTOR_IMAP_USER" os-env >>email "FACTOR_IMAP_PASSWORD" os-env >>password \ imap-settings set-global save' ; ret=$? ; echo "=== $ret ==="; [ $ret == 0 ] ) &&
( echo "=== Mkdir ===" ; mkdir -p mason/builds ; ret=$? ; echo "=== $ret ==="; [ $ret == 0 ] ) &&
( echo "=== Factor tests ===" ; cd mason/builds && ../../factor -e='USING: namespaces tools.test mason.test ; f long-unit-tests-enabled? set-global do-all' < /dev/null | awk 'NR<1000 || /^Loading resource|Unit Test/' ; ret=${PIPESTATUS[0]} ; echo "=== $ret ==="; [ $ret == 0 ]) &&
( echo "=== Factor tests ===" ; cd mason/builds && ../../factor -e='USING: namespaces tools.test mason.test benchmark ; f long-unit-tests-enabled? set-global t benchmarks-disabled? set-global do-all' < /dev/null | awk 'NR<1000 || /^Loading resource|Unit Test/' ; ret=${PIPESTATUS[0]} ; echo "=== $ret ==="; [ $ret == 0 ]) &&
( echo "=== Factor report === " ; cd mason && ../factor -e='USING: mason.config mason.report namespaces ; "." builds-dir [ successful-report ] with-variable' ; ret=$? ; echo "=== $ret ==="; [ $ret == 0 ]) &&
( echo "=== Dump report === " ;[[ "$TRAVIS_OS_NAME" != "osx" ]] && links -dump mason/report || cat mason/report ; ret=$? ; echo "=== $ret ==="; [ $ret == 0 ]) &&
[ ! -s mason/test-all-errors ]

View File

@ -1,20 +1,22 @@
Copyright (c) 2017, Slava Pestov, et al.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.

View File

@ -4,7 +4,7 @@ USING: assocs bootstrap.image checksums checksums.md5
http.client io.files kernel math.parser splitting urls ;
IN: bootstrap.image.download
CONSTANT: url URL" http://downloads.factorcode.org/images/latest/"
CONSTANT: url URL" http://downloads.factorcode.org/images/master/"
: download-checksums ( -- alist )
url "checksums.txt" >url derive-url http-get nip

View File

@ -12,7 +12,7 @@ SYMBOL: build-images-destination
: latest-destination ( -- dest )
upload-images-destination get
"sheeple@downloads.factorcode.org:downloads.factorcode.org/images/latest/"
"sheeple@downloads.factorcode.org:downloads.factorcode.org/images/master/"
or ;
: build-destination ( -- dest )

View File

@ -8,20 +8,20 @@ HELP: send
{ $values { "message" object }
{ "thread" thread }
}
{ $description "Send the message to the thread by placing it in the threads mailbox. This is an asynchronous operation and will return immediately. The receiving thread will act on the message the next time it retrieves that item from its mailbox (usually using the " { $link receive } " word. The message can be any Factor object. For destinations that are instances of remote-thread the message must be a serializable Factor type." }
{ $description "Send the message to the thread by placing it in the thread's mailbox. This is an asynchronous operation and will return immediately. The receiving thread will act on the message the next time it retrieves that item from its mailbox (usually using the " { $link receive } " word. The message can be any Factor object. For destinations that are instances of remote-thread the message must be a serializable Factor type." }
{ $see-also receive receive-if } ;
HELP: receive
{ $values { "message" object }
}
{ $description "Return a message from the current threads mailbox. If the box is empty, suspend the thread until another thread places an item in the mailbox (usually via the " { $link send } " word)." }
{ $description "Return a message from the current thread's mailbox. If the box is empty, suspend the thread until another thread places an item in the mailbox (usually via the " { $link send } " word)." }
{ $see-also send receive-if } ;
HELP: receive-if
{ $values { "pred" "a predicate with stack effect " { $snippet "( obj -- ? )" } }
{ "message" object }
}
{ $description "Return the first message from the current threads mailbox that satisfies the predicate. To satisfy the predicate, " { $snippet "pred" } " is called with the item on the stack and the predicate should leave a boolean indicating whether it was satisfied or not. If nothing in the mailbox satisfies the predicate then the thread will block until something does." }
{ $description "Return the first message from the current thread's mailbox that satisfies the predicate. To satisfy the predicate, " { $snippet "pred" } " is called with the item on the stack and the predicate should leave a boolean indicating whether it was satisfied or not. If nothing in the mailbox satisfies the predicate then the thread will block until something does." }
{ $see-also send receive } ;
HELP: spawn-linked

View File

@ -10,7 +10,7 @@ LIBRARY: glib
<< "glib" {
{ [ os windows? ] [ "libglib-2.0-0.dll" ] }
{ [ os macosx? ] [ "libglib-2.0.0.dylib" ] }
{ [ os macosx? ] [ "libglib-2.0.dylib" ] }
{ [ os unix? ] [ "libglib-2.0.so" ] }
} cond cdecl add-library >>

View File

@ -3,12 +3,25 @@
USING: accessors io.sockets.secure kernel ;
IN: io.sockets.secure.debug
: <test-secure-config> ( -- config )
<secure-config>
"vocab:openssl/test/server.pem" >>key-file
"vocab:openssl/test/dh1024.pem" >>dh-file
GENERIC: <test-secure-config>* ( obj -- config )
M: TLSv1 <test-secure-config>* ( obj -- config )
drop <secure-config>
"vocab:openssl/test-1.0/server.pem" >>key-file
"vocab:openssl/test-1.0/dh1024.pem" >>dh-file
"password" >>password ;
M: object <test-secure-config>* ( obj -- config )
drop <secure-config>
"vocab:openssl/test-1.2/server.pem" >>key-file
"vocab:openssl/test-1.2/dh1024.pem" >>dh-file
"password" >>password ;
: <test-secure-config> ( -- config )
best-tls-method <test-secure-config>* ;
: with-test-context ( quot -- )
<test-secure-config>
swap with-secure-context ; inline

View File

@ -1,9 +1,10 @@
USING: accessors calendar classes concurrency.conditions
concurrency.mailboxes concurrency.promises continuations
destructors io io.backend.unix io.encodings.ascii io.sockets
io.sockets.secure io.sockets.secure.debug io.streams.duplex
io.timeouts kernel locals namespaces threads tools.test ;
QUALIFIED-WITH: concurrency.messaging qm
IN: io.sockets.secure.tests
USING: accessors kernel namespaces io io.sockets
io.sockets.secure io.encodings.ascii io.streams.duplex
io.backend.unix classes words destructors threads tools.test
concurrency.promises byte-arrays locals calendar io.timeouts
io.sockets.secure.debug ;
{ 1 0 } [ [ ] with-secure-context ] must-infer-as
@ -19,13 +20,24 @@ io.sockets.secure.debug ;
] curry with-stream
] with-disposal
] with-test-context
] "SSL server test" spawn drop ;
] "SSL server test" qm:spawn-linked drop
! This is hideous.
! If we fail with a timeout, the test is passing.
! If we fail with something besides a timeout, rethrow it and fail the test.
[ qm:my-mailbox 200 milliseconds mailbox-get-timeout drop ]
[ dup timed-out-error? [ drop ] [ rethrow ] if ] recover ;
: ?promise-test ( mailbox -- obj )
340 milliseconds ?promise-timeout ;
: client-test ( -- string )
<secure-config> [
"127.0.0.1" "port" get ?promise <inet4> f <secure> ascii <client> drop stream-contents
"127.0.0.1" "port" get ?promise-test <inet4> f <secure> ascii <client> drop
1 seconds
[ stream-contents ] with-timeout*
] with-secure-context ;
! { } [ [ class-of name>> write "done" my-mailbox mailbox-put ] server-test ] unit-test
{ } [ [ class-of name>> write ] server-test ] unit-test
{ "secure" } [ client-test ] unit-test
@ -55,7 +67,7 @@ io.sockets.secure.debug ;
[
<secure-config> [
"localhost" "port" get ?promise <inet> f <secure> ascii
"localhost" "port" get ?promise-test <inet> f <secure> ascii
<client> drop dispose
] with-secure-context
] [ certificate-verify-error? ] must-fail-with
@ -85,7 +97,7 @@ io.sockets.secure.debug ;
{ } [
[
[
"127.0.0.1" "port" get ?promise
"127.0.0.1" "port" get ?promise-test
<inet4> ascii <client> drop &dispose 1 minutes sleep
] with-destructors
] "Silly client" spawn drop
@ -126,7 +138,7 @@ io.sockets.secure.debug ;
[
1 seconds secure-socket-timeout [
<secure-config> [
"127.0.0.1" "port" get ?promise <inet4> f <secure>
"127.0.0.1" "port" get ?promise-test <inet4> f <secure>
ascii <client> drop dispose
] with-secure-context
] with-variable
@ -139,7 +151,7 @@ io.sockets.secure.debug ;
[
[
[
"127.0.0.1" "port" get ?promise
"127.0.0.1" "port" get ?promise-test
<inet4> f <secure> ascii <client> drop &dispose 1 minutes sleep
] with-test-context
] with-destructors

View File

@ -0,0 +1,32 @@
-----BEGIN RSA PRIVATE KEY-----
Proc-Type: 4,ENCRYPTED
DEK-Info: DES-EDE3-CBC,5772A2A7BE34B611
1yJ+xAn4MudcIfXXy7ElYngJ9EohIh8yvcyVLmE4kVd0xeaL/Bqhvk25BjYCK5d9
k1K8cjgnKEBjbC++0xtJxFSbUhwoKTLwn+sBoJDcFzMKkmJXXDbSTOaNr1sVwiAR
SnB4lhUcHguYoV5zlRJn53ft7t1mjB6RwGH+d1Zx6t95OqM1lnKqwekwmotVAWHj
ncu3N8qhmoPMppmzEv0fOo2/pK2WohcJykSeN5zBrZCUxoO0NBNEZkFUcVjR+KsA
1ZeI1mU60szqg+AoU/XtFcow8RtG1QZKQbbXzyfbwaG+6LqkHaWYKHQEI1546yWK
us1HJ734uUkZoyyyazG6PiGCYV2u/aY0i3qdmyDqTvmVIvve7E4glBrtDS9h7D40
nPShIvOatoPzIK4Y0QSvrI3G1vTsIZT3IOZto4AWuOkLNfYS2ce7prOreF0KjhV0
3tggw9pHdDmTjHTiIkXqheZxZ7TVu+pddZW+CuB62I8lCBGPW7os1f21e3eOD/oY
YPCI44aJvgP+zUORuZBWqaSJ0AAIuVW9S83Yzkz/tlSFHViOebyd8Cug4TlxK1VI
q6hbSafh4C8ma7YzlvqjMzqFifcIolcbx+1A6ot0UiayJTUra4d6Uc4Rbc9RIiG0
jfDWC6aii9YkAgRl9WqSd31yASge/HDqVXFwR48qdlYQ57rcHviqxyrwRDnfw/lX
Mf6LPiDKEco4MKej7SR2kK2c2AgxUzpGZeAY6ePyhxbdhA0eY21nDeFd/RbwSc5s
eTiCCMr41OB4hfBFXKDKqsM3K7klhoz6D5WsgE6u3lDoTdz76xOSTg==
-----END RSA PRIVATE KEY-----
-----BEGIN CERTIFICATE-----
MIICGDCCAYECAgEBMA0GCSqGSIb3DQEBBAUAMFcxCzAJBgNVBAYTAlVTMRMwEQYD
VQQKEwpSVEZNLCBJbmMuMRkwFwYDVQQLExBXaWRnZXRzIERpdmlzaW9uMRgwFgYD
VQQDEw9UZXN0IENBMjAwMTA1MTcwHhcNMDEwNTE3MTYxMDU5WhcNMDQwMzA2MTYx
MDU5WjBRMQswCQYDVQQGEwJVUzETMBEGA1UEChMKUlRGTSwgSW5jLjEZMBcGA1UE
CxMQV2lkZ2V0cyBEaXZpc2lvbjESMBAGA1UEAxMJbG9jYWxob3N0MIGfMA0GCSqG
SIb3DQEBAQUAA4GNADCBiQKBgQCiWhMjNOPlPLNW4DJFBiL2fFEIkHuRor0pKw25
J0ZYHW93lHQ4yxA6afQr99ayRjMY0D26pH41f0qjDgO4OXskBsaYOFzapSZtQMbT
97OCZ7aHtK8z0ZGNW/cslu+1oOLomgRxJomIFgW1RyUUkQP1n0hemtUdCLOLlO7Q
CPqZLQIDAQABMA0GCSqGSIb3DQEBBAUAA4GBAIumUwl1OoWuyN2xfoBHYAs+lRLY
KmFLoI5+iMcGxWIsksmA+b0FLRAN43wmhPnums8eXgYbDCrKLv2xWcvKDP3mps7m
AMivwtu/eFpYz6J8Mo1fsV4Ys08A/uPXkT23jyKo2hMu8mywkqXCXYF2e+7pEeBr
dsbmkWK5NgoMl8eM
-----END CERTIFICATE-----

View File

@ -0,0 +1,5 @@
-----BEGIN DH PARAMETERS-----
MIGHAoGBANmAnfkETuKHOCWaE+W+F3kM/e7z5A8hZb7OqwGMQrUOaBEAr4BWeZBn
G/87hhwZgNP69/KUchm714qd/PpOspCaUJ20x6PcmKujpAgca/f19HGMBjRawQMk
R9oaBwazuQT0l0rTTKmvpMEcrQQIcVWii3CZI56I56oqF8biGPD7AgEC
-----END DH PARAMETERS-----

View File

@ -0,0 +1,14 @@
-----BEGIN CERTIFICATE-----
MIICIjCCAYugAwIBAgIBADANBgkqhkiG9w0BAQQFADBXMQswCQYDVQQGEwJVUzET
MBEGA1UEChMKUlRGTSwgSW5jLjEZMBcGA1UECxMQV2lkZ2V0cyBEaXZpc2lvbjEY
MBYGA1UEAxMPVGVzdCBDQTIwMDEwNTE3MB4XDTAxMDUxNzE2MDExNFoXDTA2MTIy
NTE2MDExNFowVzELMAkGA1UEBhMCVVMxEzARBgNVBAoTClJURk0sIEluYy4xGTAX
BgNVBAsTEFdpZGdldHMgRGl2aXNpb24xGDAWBgNVBAMTD1Rlc3QgQ0EyMDAxMDUx
NzCBnzANBgkqhkiG9w0BAQEFAAOBjQAwgYkCgYEAmkX40warmH0+lnwD9YjsJhRz
ZX6qXadFry0y2trZ6gMs8Mv33IKPwOu8TE7V+3PESEtjI2wr8juV9OkbIPOm+td5
M8+6vXyIW+JBo3ch99i0QMTf5/jTgsW+3IjV8yEdiGcZFp2NWKLRvZPq2VRbuF7R
1pvgcaRuBJ0wGOohwnsCAwEAATANBgkqhkiG9w0BAQQFAAOBgQCUB8zMKIlX5io8
TalbzH9Qke7BcvFAL+wp/5w1ToVsWkNrINSWKv6bl/jcqOD3aPhK7qhaeOU8ZWKL
PoPPCnRl9Wo+1JtsOO3qIgJP79Bl9ooLGahixF2v/gea5qNISjQvwYllLSa//APP
6kXHngO0RIRbiTBYHSkAzm6hDdsvVA==
-----END CERTIFICATE-----

View File

@ -57,9 +57,9 @@ delete-staging-images
{ } [ "gpu.demos.raytrace" shake-and-bake 3557800 small-enough? ] long-unit-test
! { } [ "bunny" shake-and-bake 2559640 small-enough? ] long-unit-test
{ } [ "bunny" shake-and-bake 2590476 small-enough? ] long-unit-test
{ } [ "bunny" shake-and-bake 2700000 small-enough? ] long-unit-test
{ } [ "gpu.demos.bunny" shake-and-bake 3600000 small-enough? ] long-unit-test
{ } [ "gpu.demos.bunny" shake-and-bake 3630000 small-enough? ] long-unit-test
os macosx? [
[ ] [ "webkit-demo" shake-and-bake 600000 small-enough? ] long-unit-test

View File

@ -1,8 +1,8 @@
USING: accessors sequences tools.test ui.gadgets
ui.gadgets.labeled ;
USING: accessors colors.constants sequences tools.test
ui.gadgets ui.gadgets.labeled ;
IN: ui.gadgets.labeled.tests
{ t } [
<gadget> "Hey" <labeled-gadget>
children>> first content>> gadget?
<gadget> "Hey" COLOR: blue <labeled-gadget>
content>> gadget?
] unit-test

View File

@ -1,14 +1,19 @@
@echo off
setlocal
: Fun syntax
for /f %%x in ('git describe --all') do set GIT_DESCRIBE=%%x
for /f %%y in ('git rev-parse HEAD') do set GIT_ID=%%y
for /f %%z in ('git rev-parse --abbrev-ref HEAD') do set GIT_BRANCH=%%z
if "%1"=="/?" (
goto usage
) else if "%1"=="" (
set _bootimage_version=latest
set _bootimage_version=%GIT_BRANCH%
) else if "%1"=="latest" (
set _bootimage_version=latest
set _bootimage_version=%GIT_BRANCH%
) else if "%1"=="update" (
set _bootimage_version=latest
set _bootimage_version=%GIT_BRANCH%
) else if "%1"=="clean" (
set _bootimage_version=clean
) else goto usage
@ -29,11 +34,6 @@ if not errorlevel 1 (
) else goto nocl
)
: Fun syntax
for /f %%x in ('git describe --all') do set GIT_DESCRIBE=%%x
for /f %%y in ('git rev-parse HEAD') do set GIT_ID=%%y
for /f %%z in ('git rev-parse --abbrev-ref HEAD') do set GIT_BRANCH=%%z
set git_label=%GIT_DESCRIBE%-%GIT_ID%
set version=0.98

View File

@ -362,6 +362,7 @@ echo_build_info() {
$ECHO NUM_CORES=$NUM_CORES
$ECHO WORD=$WORD
$ECHO DEBUG=$DEBUG
$ECHO CURRENT_BRANCH=$CURRENT_BRANCH
$ECHO FACTOR_BINARY=$FACTOR_BINARY
$ECHO FACTOR_LIBRARY=$FACTOR_LIBRARY
$ECHO FACTOR_IMAGE=$FACTOR_IMAGE
@ -436,6 +437,7 @@ find_build_info() {
find_num_cores
set_cc
find_word_size
find_branch
set_factor_binary
set_factor_library
set_factor_image
@ -557,12 +559,21 @@ current_git_branch() {
git rev-parse --abbrev-ref HEAD
}
find_branch() {
if [ -z ${TRAVIS_BRANCH} ]; then
CURRENT_BRANCH=$(current_git_branch)
else
CURRENT_BRANCH=${TRAVIS_BRANCH}
fi
}
checksum_url() {
branch=$(current_git_branch)
echo "http://downloads.factorcode.org/images/$branch/checksums.txt"
find_branch
echo "http://downloads.factorcode.org/images/$CURRENT_BRANCH/checksums.txt"
}
update_boot_images() {
find_branch
$ECHO "Deleting old images..."
$DELETE checksums.txt* > /dev/null 2>&1
# delete boot images with one or two characters after the dot
@ -587,8 +598,8 @@ update_boot_images() {
}
boot_image_url() {
branch=$(current_git_branch)
echo "http://downloads.factorcode.org/images/$branch/$BOOT_IMAGE"
find_branch
echo "http://downloads.factorcode.org/images/$CURRENT_BRANCH/$BOOT_IMAGE"
}
get_boot_image() {
@ -737,3 +748,4 @@ case "$1" in
full-report) find_build_info; check_installed_programs; check_libraries ;;
*) usage ;;
esac

View File

@ -41,7 +41,7 @@ HELP: checksum-file
{ $example
"USING: checksums checksums.crc32 prettyprint ;"
"\"resource:LICENSE.txt\" crc32 checksum-file ."
"B{ 100 139 199 92 }"
"B{ 47 65 106 90 }"
}
} ;

View File

@ -6,6 +6,8 @@ sequences tools.profiler.sampling tools.test tools.time
vocabs.hierarchy vocabs.loader ;
IN: benchmark
SYMBOL: benchmarks-disabled?
: run-timing-benchmark ( vocab -- time )
5 swap '[ gc [ _ run ] benchmark ] replicate infimum ;
@ -16,7 +18,12 @@ IN: benchmark
"benchmark" disk-child-vocab-names [ find-vocab-root ] filter ;
: find-benchmark-vocabs ( -- seq )
command-line get [ all-benchmark-vocabs ] when-empty ;
benchmarks-disabled? get [
"benchmarks-disabled? is true, not benchmarking anything!" print
{ }
] [
command-line get [ all-benchmark-vocabs ] when-empty
] if ;
<PRIVATE

View File

@ -5,42 +5,42 @@ FROM: cpu.arm.assembler => B ;
: test-opcode ( expect quot -- ) [ { } make first ] curry unit-test ;
[ 0xea000000 ] [ 0 B ] test-opcode
[ 0xeb000000 ] [ 0 BL ] test-opcode
! [ 0xe12fff30 ] [ R0 BLX ] test-opcode
{ 0xea000000 } [ 0 B ] test-opcode
{ 0xeb000000 } [ 0 BL ] test-opcode
! { 0xe12fff30 } [ R0 BLX ] test-opcode
[ 0xe24cc004 ] [ IP IP 4 SUB ] test-opcode
[ 0xe24cb004 ] [ FP IP 4 SUB ] test-opcode
[ 0xe087e3ac ] [ LR R7 IP 7 <LSR> ADD ] test-opcode
[ 0xe08c0109 ] [ R0 IP R9 2 <LSL> ADD ] test-opcode
[ 0x02850004 ] [ R0 R5 4 EQ ADD ] test-opcode
[ 0x00000000 ] [ R0 R0 R0 EQ AND ] test-opcode
{ 0xe24cc004 } [ IP IP 4 SUB ] test-opcode
{ 0xe24cb004 } [ FP IP 4 SUB ] test-opcode
{ 0xe087e3ac } [ LR R7 IP 7 <LSR> ADD ] test-opcode
{ 0xe08c0109 } [ R0 IP R9 2 <LSL> ADD ] test-opcode
{ 0x02850004 } [ R0 R5 4 EQ ADD ] test-opcode
{ 0x00000000 } [ R0 R0 R0 EQ AND ] test-opcode
[ 0xe1a0c00c ] [ IP IP MOV ] test-opcode
[ 0xe1a0c00d ] [ IP SP MOV ] test-opcode
[ 0xe3a03003 ] [ R3 3 MOV ] test-opcode
[ 0xe1a00003 ] [ R0 R3 MOV ] test-opcode
[ 0xe1e01c80 ] [ R1 R0 25 <LSL> MVN ] test-opcode
[ 0xe1e00ca1 ] [ R0 R1 25 <LSR> MVN ] test-opcode
[ 0x11a021ac ] [ R2 IP 3 <LSR> NE MOV ] test-opcode
{ 0xe1a0c00c } [ IP IP MOV ] test-opcode
{ 0xe1a0c00d } [ IP SP MOV ] test-opcode
{ 0xe3a03003 } [ R3 3 MOV ] test-opcode
{ 0xe1a00003 } [ R0 R3 MOV ] test-opcode
{ 0xe1e01c80 } [ R1 R0 25 <LSL> MVN ] test-opcode
{ 0xe1e00ca1 } [ R0 R1 25 <LSR> MVN ] test-opcode
{ 0x11a021ac } [ R2 IP 3 <LSR> NE MOV ] test-opcode
[ 0xe3530007 ] [ R3 7 CMP ] test-opcode
{ 0xe3530007 } [ R3 7 CMP ] test-opcode
[ 0xe008049a ] [ R8 SL R4 MUL ] test-opcode
{ 0xe008049a } [ R8 SL R4 MUL ] test-opcode
[ 0xe5151004 ] [ R1 R5 4 <-> LDR ] test-opcode
[ 0xe41c2004 ] [ R2 IP 4 <-!> LDR ] test-opcode
[ 0xe50e2004 ] [ R2 LR 4 <-> STR ] test-opcode
{ 0xe5151004 } [ R1 R5 4 <-> LDR ] test-opcode
{ 0xe41c2004 } [ R2 IP 4 <-!> LDR ] test-opcode
{ 0xe50e2004 } [ R2 LR 4 <-> STR ] test-opcode
[ 0xe7910002 ] [ R0 R1 R2 <+> LDR ] test-opcode
[ 0xe7910102 ] [ R0 R1 R2 2 <LSL> <+> LDR ] test-opcode
{ 0xe7910002 } [ R0 R1 R2 <+> LDR ] test-opcode
{ 0xe7910102 } [ R0 R1 R2 2 <LSL> <+> LDR ] test-opcode
[ 0xe1d310bc ] [ R1 R3 12 <+> LDRH ] test-opcode
[ 0xe1d310fc ] [ R1 R3 12 <+> LDRSH ] test-opcode
[ 0xe1d310dc ] [ R1 R3 12 <+> LDRSB ] test-opcode
[ 0xe1c310bc ] [ R1 R3 12 <+> STRH ] test-opcode
[ 0xe19310b4 ] [ R1 R3 R4 <+> LDRH ] test-opcode
[ 0xe1f310fc ] [ R1 R3 12 <!+> LDRSH ] test-opcode
[ 0xe1b310d4 ] [ R1 R3 R4 <!+> LDRSB ] test-opcode
[ 0xe0c317bb ] [ R1 R3 123 <+!> STRH ] test-opcode
[ 0xe08310b4 ] [ R1 R3 R4 <+!> STRH ] test-opcode
{ 0xe1d310bc } [ R1 R3 12 <+> LDRH ] test-opcode
{ 0xe1d310fc } [ R1 R3 12 <+> LDRSH ] test-opcode
{ 0xe1d310dc } [ R1 R3 12 <+> LDRSB ] test-opcode
{ 0xe1c310bc } [ R1 R3 12 <+> STRH ] test-opcode
{ 0xe19310b4 } [ R1 R3 R4 <+> LDRH ] test-opcode
{ 0xe1f310fc } [ R1 R3 12 <!+> LDRSH ] test-opcode
{ 0xe1b310d4 } [ R1 R3 R4 <!+> LDRSB ] test-opcode
{ 0xe0c317bb } [ R1 R3 123 <+!> STRH ] test-opcode
{ 0xe08310b4 } [ R1 R3 R4 <+!> STRH ] test-opcode

2
extra/fftw/tags.txt Normal file
View File

@ -0,0 +1,2 @@
not tested

View File

@ -1 +0,0 @@
Doug Coleman

View File

@ -1,468 +0,0 @@
! Copyright (C) 2014 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: alien alien.c-types alien.libraries
alien.libraries.finder alien.syntax classes.struct kernel ;
IN: forestdb.ffi
! Functions with LIBFDB_API are exported.
<< "forestdb" dup find-library cdecl add-library >>
LIBRARY: forestdb
! Begin fdb_types.h
CONSTANT: FDB_MAX_KEYLEN 3840
CONSTANT: FDB_MAX_METALEN 65512
CONSTANT: FDB_MAX_BODYLEN 4294967295
CONSTANT: FDB_SNAPSHOT_INMEM -1
TYPEDEF: uint64_t fdb_seqnum_t
TYPEDEF: int64_t cs_off_t
TYPEDEF: long fdb_ssize_t ! XXX: platform dependent?
TYPEDEF: void* fdb_custom_cmp_fixed
TYPEDEF: void* fdb_custom_cmp_variable
TYPEDEF: void* fdb_file_handle
TYPEDEF: void* fdb_kvs_handle
TYPEDEF: void* fdb_iterator
TYPEDEF: void* fdb_changes_callback_fn
TYPEDEF: void* voidref
TYPEDEF: void* fdb_handle_stats_cb
ENUM: fdb_open_flags < uint32_t
{ FDB_OPEN_FLAG_CREATE 1 }
{ FDB_OPEN_FLAG_RDONLY 2 }
{ FDB_OPEN_WITH_LEGACY_CRC 4 } ;
ENUM: fdb_commit_opt_t < uint8_t
{ FDB_COMMIT_NORMAL 0 }
{ FDB_COMMIT_MANUAL_WAL_FLUSH 1 } ;
ENUM: fdb_seqtree_opt_t < uint8_t
{ FDB_SEQTREE_NOT_USE 0 }
{ FDB_SEQTREE_USE 1 } ;
ENUM: fdb_durability_opt_t < uint8_t
{ FDB_DRB_NONE 0 }
{ FDB_DRB_ODIRECT 1 }
{ FDB_DRB_ASYNC 2 }
{ FDB_DRB_ODIRECT_ASYNC 3 } ;
ENUM: fdb_compaction_mode_t < uint8_t
{ FDB_COMPACTION_MANUAL 0 }
{ FDB_COMPACTION_AUTO 1 } ;
ENUM: fdb_isolation_level_t < uint8_t
{ FDB_ISOLATION_READ_COMMITTED 2 }
{ FDB_ISOLATION_READ_UNCOMMITTED 3 } ;
ENUM: fdb_iterator_opt_t < uint16_t
{ FDB_ITR_NONE 0 }
{ FDB_ITR_NO_DELETES 2 }
{ FDB_ITR_SKIP_MIN_KEY 4 }
{ FDB_ITR_SKIP_MAX_KEY 8 }
{ FDB_ITR_NO_VALUES 0x10 } ; ! only keys and metadata for fdb_changes_since
ENUM: fdb_changes_decision < int32_t
{ FDB_CHANGES_PRESERVE 1 }
{ FDB_CHANGES_CLEAN 0 }
{ FDB_CHANGES_CANCEL -1 } ;
ENUM: fdb_iterator_seek_opt_t < uint8_t
{ FDB_ITR_SEEK_HIGHER 0 }
{ FDB_ITR_SEEK_LOWER 1 } ;
ENUM: fdb_compaction_status < uint32_t
{ FDB_CS_BEGIN 0x1 }
{ FDB_CS_MOVE_DOC 0x2 }
{ FDB_CS_BATCH_MOVE 0x4 }
{ FDB_CS_FLUSH_WAL 0x8 }
{ FDB_CS_END 0x10 }
{ FDB_CS_COMPLETE 0x20 } ;
ENUM: fdb_compact_decision < int
{ FDB_CS_KEEP_DOC 0 }
{ FDB_CS_DROP_DOC 1 } ;
ENUM: fdb_encryption_algorithm_t < int
{ FDB_ENCRYPTION_NONE 0 }
{ FDB_ENCRYPTION_AES256 1 } ;
STRUCT: fdb_doc
{ keylen size_t }
{ metalen size_t }
{ bodylen size_t }
{ size_ondisk size_t }
{ key void* }
{ seqnum fdb_seqnum_t }
{ offset uint64_t }
{ meta void* }
{ body void* }
{ deleted bool }
{ flags uint32_t } ;
CALLBACK: void fdb_log_callback ( int err_code, char* err_msg, void* ctx_data )
CALLBACK: void fdb_fatal_error_callback ( )
CALLBACK: fdb_compact_decision fdb_compaction_callback (
fdb_file_handle* fhandle,
fdb_compaction_status status,
char* kv_store_name,
fdb_doc* doc,
uint64_t last_oldfile_offset,
uint64_t last_newfile_offset,
void* ctx )
STRUCT: fdb_encryption_key
{ algorithm fdb_encryption_algorithm_t }
{ bytes uint8_t[32] } ;
STRUCT: fdb_filemgr_ops_t
{ constructor void* }
{ open void* }
{ pwrite void* }
{ pread void* }
{ close void* }
{ goto_eof void* }
{ file_size void* }
{ fdatasync void* }
{ sync void* }
{ get_errno_str void* }
{ mmap void* }
{ munmap void* }
{ aio_init void* }
{ aio_prep_read void* }
{ aio_submit void* }
{ aio_getevents void* }
{ aio_destroy void* }
{ get_fs_type void* }
{ copy_file_range void* }
{ destructor void* }
{ ctx void* } ;
! cmp_fixed and cmp_variable have their own open() functions
STRUCT: fdb_config
{ chunksize uint16_t }
{ blocksize uint32_t }
{ buffercache_size uint64_t }
{ wal_threshold uint64_t }
{ wal_flush_before_commit bool }
{ auto_commit bool }
{ purging_interval uint32_t }
{ seqtree_opt fdb_seqtree_opt_t }
{ durability_opt fdb_durability_opt_t }
{ flags fdb_open_flags }
{ compaction_buf_maxsize uint32_t }
{ cleanup_cache_onclose bool }
{ compress_document_body bool }
{ compaction_mode fdb_compaction_mode_t }
{ compaction_threshold uint8_t }
{ compaction_minimum_filesize uint64_t }
{ compactor_sleep_duration uint64_t }
{ multi_kv_instances bool }
{ prefetch_duration uint64_t }
{ num_wal_partitions uint16_t }
{ num_bcache_partitions uint16_t }
{ compaction_cb fdb_compaction_callback }
{ compaction_cb_mask uint32_t }
{ compaction_cb_ctx void* }
{ max_writer_lock_prob size_t }
{ num_compactor_threads size_t }
{ num_bgflusher_threads size_t }
{ encryption_key fdb_encryption_key }
{ block_reusing_threshold size_t }
{ num_keeping_headers size_t }
{ breakpad_minidump_dir char* }
{ custom_file_ops fdb_filemgr_ops_t* }
{ num_background_threads size_t }
{ bcache_flush_limit size_t } ;
STRUCT: fdb_kvs_config
{ create_if_missing bool }
{ custom_cmp fdb_custom_cmp_variable } ;
! filename is a pointer to the handle's filename
! new_filename is a pointer to the handle's new_file
STRUCT: fdb_file_info
{ filename char* }
{ new_filename char* }
{ doc_count uint64_t }
{ deleted_count uint64_t }
{ space_used uint64_t }
{ file_size uint64_t }
{ num_kv_stores size_t } ;
STRUCT: fdb_kvs_info
{ name char* }
{ last_seqnum fdb_seqnum_t }
{ doc_count uint64_t }
{ deleted_count uint64_t }
{ space_used uint64_t }
{ file fdb_file_handle* } ;
STRUCT: fdb_kvs_name_list
{ num_kvs_names size_t }
{ kvs_names char** } ;
STRUCT: fdb_kvs_ops_info
{ num_sets uint64_t }
{ num_dels uint64_t }
{ num_commits uint64_t }
{ num_compacts uint64_t }
{ num_gets uint64_t }
{ num_iterator_gets uint64_t }
{ num_iterator_moves uint64_t } ;
ENUM: fdb_latency_stat_type < uint8_t
{ FDB_LATENCY_SETS 0 }
{ FDB_LATENCY_GETS 1 }
{ FDB_LATENCY_COMMITS 2 }
{ FDB_LATENCY_SNAP_INMEM 3 }
{ FDB_LATENCY_SNAP_DUR 4 }
{ FDB_LATENCY_COMPACTS 5 }
{ FDB_LATENCY_ITR_INIT 6 }
{ FDB_LATENCY_ITR_SEQ_INIT 7 }
{ FDB_LATENCY_ITR_NEXT 8 }
{ FDB_LATENCY_ITR_PREV 9 }
{ FDB_LATENCY_ITR_GET 10 }
{ FDB_LATENCY_ITR_GET_META 11 }
{ FDB_LATENCY_ITR_SEEK 12 }
{ FDB_LATENCY_ITR_SEEK_MAX 13 }
{ FDB_LATENCY_ITR_SEEK_MIN 14 }
{ FDB_LATENCY_ITR_CLOSE 15 }
{ FDB_LATENCY_OPEN 16 }
{ FDB_LATENCY_KVS_OPEN 17 }
{ FDB_LATENCY_SNAP_CLONE 18 }
{ FDB_LATENCY_WAL_INS 19 }
{ FDB_LATENCY_WAL_FIND 20 }
{ FDB_LATENCY_WAL_COMMIT 21 }
{ FDB_LATENCY_WAL_FLUSH 22 }
{ FDB_LATENCY_WAL_RELEASE 23 }
{ FDB_LATENCY_NUM_STATS 24 } ;
STRUCT: fdb_latency_stat
{ lat_count uint64_t }
{ lat_min uint32_t }
{ lat_max uint32_t }
{ lat_avg uint32_t } ;
STRUCT: fdb_kvs_commit_marker_t
{ kv_store_name char* }
{ seqnum fdb_seqnum_t } ;
TYPEDEF: uint64_t fdb_snapshot_marker_t
STRUCT: fdb_snapshot_info_t
{ marker fdb_snapshot_marker_t }
{ num_kvs_markers int64_t }
{ kvs_markers fdb_kvs_commit_marker_t* } ;
! end fdb_types.h
! Begin fdb_errors.h
ENUM: fdb_status
{ FDB_RESULT_SUCCESS 0 }
{ FDB_RESULT_INVALID_ARGS -1 }
{ FDB_RESULT_OPEN_FAIL -2 }
{ FDB_RESULT_NO_SUCH_FILE -3 }
{ FDB_RESULT_WRITE_FAIL -4 }
{ FDB_RESULT_READ_FAIL -5 }
{ FDB_RESULT_CLOSE_FAIL -6 }
{ FDB_RESULT_COMMIT_FAIL -7 }
{ FDB_RESULT_ALLOC_FAIL -8 }
{ FDB_RESULT_KEY_NOT_FOUND -9 }
{ FDB_RESULT_RONLY_VIOLATION -10 }
{ FDB_RESULT_COMPACTION_FAIL -11 }
{ FDB_RESULT_ITERATOR_FAIL -12 }
{ FDB_RESULT_SEEK_FAIL -13 }
{ FDB_RESULT_FSYNC_FAIL -14 }
{ FDB_RESULT_CHECKSUM_ERROR -15 }
{ FDB_RESULT_FILE_CORRUPTION -16 }
{ FDB_RESULT_COMPRESSION_FAIL -17 }
{ FDB_RESULT_NO_DB_INSTANCE -18 }
{ FDB_RESULT_FAIL_BY_ROLLBACK -19 }
{ FDB_RESULT_INVALID_CONFIG -20 }
{ FDB_RESULT_MANUAL_COMPACTION_FAIL -21 }
{ FDB_RESULT_INVALID_COMPACTION_MODE -22 }
{ FDB_RESULT_FILE_IS_BUSY -23 }
{ FDB_RESULT_FILE_REMOVE_FAIL -24 }
{ FDB_RESULT_FILE_RENAME_FAIL -25 }
{ FDB_RESULT_TRANSACTION_FAIL -26 }
{ FDB_RESULT_FAIL_BY_TRANSACTION -27 }
{ FDB_RESULT_FAIL_BY_COMPACTION -28 }
{ FDB_RESULT_TOO_LONG_FILENAME -29 }
{ FDB_RESULT_INVALID_HANDLE -30 }
{ FDB_RESULT_KV_STORE_NOT_FOUND -31 }
{ FDB_RESULT_KV_STORE_BUSY -32 }
{ FDB_RESULT_INVALID_KV_INSTANCE_NAME -33 }
{ FDB_RESULT_INVALID_CMP_FUNCTION -34 }
{ FDB_RESULT_IN_USE_BY_COMPACTOR -35 }
{ FDB_RESULT_FILE_NOT_OPEN -36 }
{ FDB_RESULT_TOO_BIG_BUFFER_CACHE -37 }
{ FDB_RESULT_NO_DB_HEADERS -38 }
{ FDB_RESULT_HANDLE_BUSY -39 }
{ FDB_RESULT_AIO_NOT_SUPPORTED -40 }
{ FDB_RESULT_AIO_INIT_FAIL -41 }
{ FDB_RESULT_AIO_SUBMIT_FAIL -42 }
{ FDB_RESULT_AIO_GETEVENTS_FAIL -43 }
{ FDB_RESULT_CRYPTO_ERROR -44 }
{ FDB_RESULT_COMPACTION_CANCELLATION -45 }
{ FDB_RESULT_SB_INIT_FAIL -46 }
{ FDB_RESULT_SB_RACE_CONDITION -47 }
{ FDB_RESULT_SB_READ_FAIL -48 }
{ FDB_RESULT_FILE_VERSION_NOT_SUPPORTED -49 }
{ FDB_RESULT_EPERM -50 }
{ FDB_RESULT_EIO -51 }
{ FDB_RESULT_ENXIO -52 }
{ FDB_RESULT_EBADF -53 }
{ FDB_RESULT_ENOMEM -54 }
{ FDB_RESULT_EACCESS -55 }
{ FDB_RESULT_EFAULT -56 }
{ FDB_RESULT_EEXIST -57 }
{ FDB_RESULT_ENODEV -58 }
{ FDB_RESULT_ENOTDIR -59 }
{ FDB_RESULT_EISDIR -60 }
{ FDB_RESULT_EINVAL -61 }
{ FDB_RESULT_ENFILE -62 }
{ FDB_RESULT_EMFILE -63 }
{ FDB_RESULT_EFBIG -64 }
{ FDB_RESULT_ENOSPC -65 }
{ FDB_RESULT_EROFS -66 }
{ FDB_RESULT_EOPNOTSUPP -67 }
{ FDB_RESULT_ENOBUFS -68 }
{ FDB_RESULT_ELOOP -69 }
{ FDB_RESULT_ENAMETOOLONG -70 }
{ FDB_RESULT_EOVERFLOW -71 }
{ FDB_RESULT_EAGAIN -72 }
{ FDB_RESULT_CANCELLED -73 }
{ FDB_RESULT_ENGINE_NOT_INSTANTIATED -74 }
{ FDB_RESULT_LOG_FILE_NOT_FOUND -75 }
{ FDB_RESULT_LOCK_FAIL -76 }
{ FDB_RESULT_LAST -76 }
; ! update this
! End fdb_errors.h
! Begin forestdb.h
FUNCTION: fdb_status fdb_init ( fdb_config* config )
FUNCTION: fdb_config fdb_get_default_config ( )
FUNCTION: fdb_kvs_config fdb_get_default_kvs_config ( )
FUNCTION: fdb_status fdb_open ( fdb_file_handle** ptr_fhandle, c-string filename, fdb_config* fconfig )
FUNCTION: fdb_status fdb_open_custom_cmp ( fdb_file_handle** ptr_fhandle, c-string filename, fdb_config* fconfig, size_t num_functions, char** kvs_names, fdb_custom_cmp_variable* functions )
FUNCTION: fdb_status fdb_set_log_callback ( fdb_kvs_handle* handle, fdb_log_callback log_callback, void* ctx_data )
FUNCTION: void fdb_set_fatal_error_callback ( fdb_fatal_error_callback err_callback )
! doc is calloc'd
FUNCTION: fdb_status fdb_doc_create ( fdb_doc** doc, void* key, size_t keylen, void* meta, size_t metalen, void* body, size_t bodylen )
FUNCTION: fdb_status fdb_doc_update ( fdb_doc** doc, void* meta, size_t metalen, void* body, size_t bodylen )
FUNCTION: fdb_status fdb_doc_set_seqnum ( fdb_doc* doc, fdb_seqnum_t seqnum )
FUNCTION: fdb_status fdb_doc_free ( fdb_doc* doc )
FUNCTION: fdb_status fdb_get ( fdb_kvs_handle* handle, fdb_doc* doc )
FUNCTION: fdb_status fdb_get_metaonly ( fdb_kvs_handle* handle, fdb_doc* doc )
FUNCTION: fdb_status fdb_get_byseq ( fdb_kvs_handle* handle, fdb_doc* doc )
FUNCTION: fdb_status fdb_get_metaonly_byseq ( fdb_kvs_handle* handle, fdb_doc* doc )
FUNCTION: fdb_status fdb_get_byoffset ( fdb_kvs_handle* handle, fdb_doc* doc )
FUNCTION: fdb_status fdb_set ( fdb_kvs_handle* handle, fdb_doc* doc )
FUNCTION: fdb_status fdb_del ( fdb_kvs_handle* handle, fdb_doc* doc )
FUNCTION: fdb_status fdb_get_kv ( fdb_kvs_handle* handle, void* key, size_t keylen, void** value_out, size_t* valuelen_out )
FUNCTION: fdb_status fdb_set_kv ( fdb_kvs_handle* handle, void* key, size_t keylen, void* value, size_t valuelen )
FUNCTION: fdb_status fdb_del_kv ( fdb_kvs_handle* handle, void* key, size_t keylen )
FUNCTION: fdb_status fdb_free_block ( void *ptr )
FUNCTION: fdb_status fdb_commit ( fdb_file_handle* fhandle, fdb_commit_opt_t opt )
FUNCTION: fdb_status fdb_snapshot_open ( fdb_kvs_handle* handle_in, fdb_kvs_handle** handle_out, fdb_seqnum_t snapshot_seqnum )
! Swaps out the handle for a new one
FUNCTION: fdb_status fdb_rollback ( fdb_kvs_handle** handle_ptr, fdb_seqnum_t rollback_seqnum )
FUNCTION: fdb_status fdb_rollback_all ( fdb_file_handle* fhandle, fdb_snapshot_marker_t marker )
FUNCTION: fdb_status fdb_iterator_init ( fdb_kvs_handle* handle, fdb_iterator** iterator, void* min_key, size_t min_keylen, void* max_key, size_t max_keylen, fdb_iterator_opt_t opt )
FUNCTION: fdb_status fdb_iterator_sequence_init ( fdb_kvs_handle* handle, fdb_iterator** iterator, fdb_seqnum_t min_seq, fdb_seqnum_t max_seq, fdb_iterator_opt_t opt )
FUNCTION: fdb_status fdb_iterator_prev ( fdb_iterator* iterator )
FUNCTION: fdb_status fdb_iterator_next ( fdb_iterator* iterator )
FUNCTION: fdb_status fdb_iterator_get ( fdb_iterator* iterator, fdb_doc **doc )
FUNCTION: fdb_status fdb_iterator_get_metaonly ( fdb_iterator* iterator, fdb_doc **doc )
FUNCTION: fdb_status fdb_iterator_seek ( fdb_iterator* iterator, void* seek_key, size_t seek_keylen, fdb_iterator_seek_opt_t direction )
FUNCTION: fdb_status fdb_iterator_seek_to_min ( fdb_iterator* iterator )
FUNCTION: fdb_status fdb_iterator_seek_to_max ( fdb_iterator* iterator )
FUNCTION: fdb_status fdb_iterator_close ( fdb_iterator* iterator )
FUNCTION: fdb_status fdb_changes_since ( fdb_kvs_handle *handle,
fdb_seqnum_t since,
fdb_iterator_opt_t opt,
fdb_changes_callback_fn callback,
void *ctx )
FUNCTION: fdb_status fdb_compact ( fdb_file_handle* fhandle, c-string new_filename )
FUNCTION: fdb_status fdb_compact_with_cow ( fdb_file_handle* fhandle, c-string new_filename )
FUNCTION: fdb_status fdb_compact_upto ( fdb_file_handle* fhandle, c-string new_filename, fdb_snapshot_marker_t marker )
FUNCTION: fdb_status fdb_compact_upto_with_cow ( fdb_file_handle* fhandle, c-string new_filename, fdb_snapshot_marker_t marker )
FUNCTION: fdb_status fdb_cancel_compaction ( fdb_file_handle* fhandle )
FUNCTION: fdb_status fdb_set_daemon_compaction_interval ( fdb_file_handle* fhandle, size_t interval )
FUNCTION: fdb_status fdb_rekey ( fdb_file_handle* fhandle, fdb_encryption_key new_key )
FUNCTION: size_t fdb_get_buffer_cache_used ( )
FUNCTION: size_t fdb_estimate_space_used ( fdb_file_handle* fhandle )
FUNCTION: size_t fdb_estimate_space_used_from ( fdb_file_handle* fhandle, fdb_snapshot_marker_t marker )
FUNCTION: fdb_status fdb_get_file_info ( fdb_file_handle* fhandle, fdb_file_info* info )
FUNCTION: fdb_status fdb_get_kvs_info ( fdb_kvs_handle* handle, fdb_kvs_info* info )
FUNCTION: fdb_status fdb_get_kvs_ops_info ( fdb_kvs_handle* handle, fdb_kvs_ops_info* info )
FUNCTION: fdb_status fdb_get_latency_stats ( fdb_file_handle* fhandle, fdb_latency_stat* stats, fdb_latency_stat_type type )
FUNCTION: fdb_status fdb_get_latency_histogram ( fdb_file_handle* fhandle,
char** stats,
size_t* stats_length,
fdb_latency_stat_type type )
FUNCTION: c-string fdb_get_latency_stat_name ( fdb_latency_stat_type type )
FUNCTION: fdb_status fdb_get_kvs_seqnum ( fdb_kvs_handle* handle, fdb_seqnum_t* seqnum )
FUNCTION: fdb_status fdb_get_kvs_name_list ( fdb_kvs_handle* handle, fdb_kvs_name_list* kvs_name_list )
FUNCTION: fdb_status fdb_get_all_snap_markers (
fdb_file_handle* fhandle,
fdb_snapshot_info_t** markers,
uint64_t* size )
FUNCTION: fdb_seqnum_t fdb_get_available_rollback_seq (
fdb_kvs_handle* handle,
uint64_t request_seqno )
FUNCTION: fdb_status fdb_free_snap_markers ( fdb_snapshot_info_t* markers, uint64_t size )
FUNCTION: fdb_status fdb_free_kvs_name_list ( fdb_kvs_name_list* kvs_name_list )
FUNCTION: fdb_status fdb_switch_compaction_mode ( fdb_file_handle* fhandle, fdb_compaction_mode_t mode, size_t new_threshold )
FUNCTION: fdb_status fdb_close ( fdb_file_handle* fhandle )
FUNCTION: fdb_status fdb_destroy ( c-string filename, fdb_config* fconfig )
FUNCTION: fdb_status fdb_shutdown ( )
FUNCTION: fdb_status fdb_begin_transaction ( fdb_file_handle* fhandle, fdb_isolation_level_t isolation_level )
FUNCTION: fdb_status fdb_end_transaction ( fdb_file_handle* fhandle, fdb_commit_opt_t opt )
FUNCTION: fdb_status fdb_abort_transaction ( fdb_file_handle* fhandle )
FUNCTION: fdb_status fdb_kvs_open ( fdb_file_handle* fhandle,
fdb_kvs_handle** ptr_handle,
c-string kvs_name,
fdb_kvs_config* config )
FUNCTION: fdb_status fdb_kvs_open_default ( fdb_file_handle* fhandle,
fdb_kvs_handle** ptr_handle,
fdb_kvs_config* config )
FUNCTION: fdb_status fdb_kvs_close ( fdb_kvs_handle* handle )
FUNCTION: fdb_status fdb_kvs_remove ( fdb_file_handle* fhandle, c-string kvs_name )
FUNCTION: fdb_status fdb_set_block_reusing_params ( fdb_file_handle* fhandle, size_t block_reusing_threshold, size_t num_keeping_headers )
FUNCTION: char* fdb_error_msg ( fdb_status err_code )
FUNCTION: char* fdb_get_lib_version ( )
FUNCTION: char* fdb_get_file_version ( fdb_file_handle* fhandle )
FUNCTION: fdb_filemgr_ops_t* fdb_get_default_file_ops ( )
FUNCTION: fdb_status fdb_fetch_handle_stats ( fdb_kvs_handle *handle,
fdb_handle_stats_cb callback,
void *ctx )

View File

@ -1 +0,0 @@
Doug Coleman

View File

@ -1,381 +0,0 @@
! Copyright (C) 2014 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.strings arrays forestdb.lib forestdb.utils kernel
make multiline sequences tools.test ;
IN: forestdb.lib.tests
! Get/set by key/value
{ "val123" } [
[
"test123" [
"key123" "val123" fdb-set-kv
"key123" fdb-get-kv
] with-kvs-name
] with-forestdb-test-manual
] unit-test
{ "val12345" } [
[
"test123" [
"key123" "val12345" fdb-set-kv
"key123" fdb-get-kv
] with-kvs-name
] with-forestdb-test-manual
] unit-test
! Get
{
{ "key1" "val" }
} [
[
5 set-kv-n
fdb-commit-normal
"key1" "meta" "val" [
fdb_doc>doc [ key>> ] [ body>> ] bi 2array
] with-create-doc
] with-forestdb-test-manual
] unit-test
{
{ "key1" f "val1" }
} [
[
5 set-kv-n
fdb-commit-normal
"key1" "no meta" "going away" [
fdb-get
fdb_doc>doc [ key>> ] [ meta>> ] [ body>> ] tri 3array
] with-create-doc
] with-forestdb-test-manual
] unit-test
{
{ "key2" f "val2" }
} [
[
5 set-kv-n
fdb-commit-normal
2 <seqnum-doc> [
fdb-get-byseq fdb_doc>doc
[ key>> ] [ meta>> ] [ body>> ] tri 3array
] with-doc
] with-forestdb-test-manual
] unit-test
{
{ "key2" f "val2" }
} [
[
5 set-kv-n
fdb-commit-normal
2 <seqnum-doc> [
fdb-get-byseq fdb_doc>doc
[ key>> ] [ meta>> ] [ body>> ] tri 3array
] with-doc
] with-forestdb-test-manual
] unit-test
! Filename is only valid inside with-forestdb
{ f } [
[
fdb-get-info filename>> alien>native-string empty?
] with-forestdb-test-manual
] unit-test
! Test fdb_doc_create
{ 6 9 9 } [
[
"key123" "meta blah" "some body" [
[ keylen>> ] [ metalen>> ] [ bodylen>> ] tri
] with-create-doc
] with-forestdb-test-manual
] unit-test
{ 7 8 15 } [
[
"key1234" "meta blah" "some body" [
[ "new meta" "some other body" fdb-doc-update ]
[ [ keylen>> ] [ metalen>> ] [ bodylen>> ] tri ] bi
] with-create-doc
] with-forestdb-test-manual
] unit-test
{ 1 1 } [
[
1 set-kv-n
fdb-commit-normal
fdb-get-kvs-info [ last_seqnum>> ] [ doc_count>> ] bi
] with-forestdb-test-manual
] unit-test
{ 6 5 } [
[
5 set-kv-n
5 set-kv-nth
fdb-commit-normal
fdb-get-kvs-info [ last_seqnum>> ] [ doc_count>> ] bi
] with-forestdb-test-manual
] unit-test
{ 5 5 } [
[
5 set-kv-n
fdb-commit-normal
fdb-get-kvs-info [ last_seqnum>> ] [ doc_count>> ] bi
] with-forestdb-test-manual
] unit-test
! Snapshots
/*
{ 5 5 } [
[
5 set-kv-n
fdb-commit-normal
FDB_SNAPSHOT_INMEM [
fdb-get-kvs-info [ last_seqnum>> ] [ doc_count>> ] bi
] with-forestdb-snapshot
] with-forestdb-test-manual
] unit-test
*/
/*
! Snapshots can only occur on commits. If you commit five keys at once,
! and then try to open a snapshot on the second key, it should fail.
! XXX: Buggy, fails in _fdb_open with FDB_RESULT_NO_DB_INSTANCE
[
delete-test-db-1
test-db-1 [
5 set-kv-n
fdb-commit-normal
FDB_SNAPSHOT_INMEM [
fdb-get-kvs-info [ last_seqnum>> ] [ doc_count>> ] bi
] with-forestdb-snapshot
] with-forestdb-tester
] [
T{ fdb-error { error FDB_RESULT_NO_DB_INSTANCE } } =
] must-fail-with
! Test that we take two snapshots and their seqnums/doc counts are right.
! XXX: Buggy, want to see the first snapshot's document count at 5 too
{
{ 7 7 }
{ 7 7 }
} [
delete-test-db-1
test-db-1 [
5 set-kv-n
fdb-commit-normal
6 7 set-kv-range
fdb-commit-normal
FDB_SNAPSHOT_INMEM [
fdb-get-kvs-info [ last_seqnum>> ] [ doc_count>> ] bi 2array
] with-forestdb-snapshot
FDB_SNAPSHOT_INMEM [
fdb-get-kvs-info [ last_seqnum>> ] [ doc_count>> ] bi 2array
] with-forestdb-snapshot
] with-forestdb-tester
] unit-test
! Same test as above, but with buggy behavior for now so it passes
{
7
7
} [
delete-test-db-1
test-db-1 [
5 set-kv-n
fdb-commit-normal
6 7 set-kv-range
fdb-commit-normal
FDB_SNAPSHOT_INMEM [
fdb-get-kvs-info last_seqnum>>
] with-forestdb-snapshot
FDB_SNAPSHOT_INMEM [
fdb-get-kvs-info last_seqnum>>
] with-forestdb-snapshot
] with-forestdb-tester
] unit-test
! Rollback test
! Make sure the doc_count is correct after a rollback
{
7
{ 5 5 }
} [
delete-test-db-1
test-db-1 [
5 set-kv-n
fdb-commit-normal
6 7 set-kv-range
fdb-commit-normal
FDB_SNAPSHOT_INMEM [
fdb-get-kvs-info last_seqnum>>
] with-forestdb-snapshot
5 fdb-rollback
FDB_SNAPSHOT_INMEM [
fdb-get-kvs-info [ last_seqnum>> ] [ doc_count>> ] bi 2array
] with-forestdb-snapshot
] with-forestdb-tester
] unit-test
*/
! Iterators test
! No matching keys
{
{ }
} [
[
5 set-kv-n
fdb-commit-normal
[
"omg" "nada" [
fdb_doc>doc [ seqnum>> ] [ key>> ] [ body>> ] tri 3array ,
] with-fdb-normal-iterator
] { } make
] with-forestdb-test-manual
] unit-test
! All the keys
{
{
{ 1 "key1" "val1" }
{ 2 "key2" "val2" }
{ 3 "key3" "val3" }
{ 4 "key4" "val4" }
{ 5 "key5" "val5" }
}
} [
[
5 set-kv-n
fdb-commit-normal
[
"key1" "key5" [
fdb_doc>doc [ seqnum>> ] [ key>> ] [ body>> ] tri 3array ,
] with-fdb-normal-iterator
] { } make
] with-forestdb-test-manual
] unit-test
! Test that keys at extremes get returned
{
{
{ 1 "key1" "val1" }
}
} [
[
5 set-kv-n
fdb-commit-normal
[
"key0" "key1" [
fdb_doc>doc [ seqnum>> ] [ key>> ] [ body>> ] tri 3array ,
] with-fdb-normal-iterator
] { } make
] with-forestdb-test-manual
] unit-test
{
{
{ 5 "key5" "val5" }
}
} [
[
5 set-kv-n
fdb-commit-normal
[
"key5" "key9" [
fdb_doc>doc [ seqnum>> ] [ key>> ] [ body>> ] tri 3array ,
] with-fdb-normal-iterator
] { } make
] with-forestdb-test-manual
] unit-test
! Test byseq mapping
{
V{ 1 2 3 4 5 }
} [
[
5 set-kv-n
fdb-commit-normal
0 10 [
fdb_doc>doc
] with-fdb-byseq-map
[ seqnum>> ] map
] with-forestdb-test-manual
] unit-test
! XXX: Behavior changed here
! No longer makes new docs that are deleted
! Deleting 5 keys gives you 5 new seqnums that are those docs, but deleted
! {
! V{ { 6 t } { 7 t } { 8 t } { 9 t } { 10 t } }
! } [
! [
! 5 set-kv-n
! 5 del-kv-n
! fdb-commit-normal
! 0 10 [
! fdb_doc>doc
! ] with-fdb-byseq-map
! [ [ seqnum>> ] [ deleted?>> ] bi 2array ] map
! ] with-forestdb-test-manual
! ] unit-test
! Test new behavior
{
V{ }
} [
[
5 set-kv-n
5 del-kv-n
fdb-commit-normal
0 10 [
fdb_doc>doc
] with-fdb-byseq-map
[ [ seqnum>> ] [ deleted?>> ] bi 2array ] map
] with-forestdb-test-manual
] unit-test
{
{
{ 1 "key1" }
{ 2 "key2" }
{ 3 "key3" }
{ 4 "key4" }
{ 5 "key5" }
}
}
[
[
5 set-kv-n
fdb-commit-normal
[
0 10 [
[ seqnum>> ]
[ [ key>> ] [ keylen>> ] bi alien/length>string ] bi 2array ,
] with-fdb-byseq-each
] { } make
] with-forestdb-test-manual
] unit-test

View File

@ -1,444 +0,0 @@
! Copyright (C) 2014 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors alien.c-types alien.data alien.strings byte-arrays
classes.struct combinators constructors continuations destructors
forestdb.ffi fry generalizations io.directories io.encodings.string
io.encodings.utf8 io.pathnames kernel libc math multiline namespaces
sequences strings ;
QUALIFIED: sets
IN: forestdb.lib
! Issues
! Get byseq ignores seqnum and uses key instead if key is set
ERROR: fdb-error error ;
: fdb-check-error ( ret -- )
dup FDB_RESULT_SUCCESS = [ drop ] [ fdb-error ] if ;
TUPLE: fdb-kvs-handle < disposable handle ;
: <fdb-kvs-handle> ( handle -- obj )
fdb-kvs-handle new-disposable
swap >>handle ; inline
M: fdb-kvs-handle dispose*
handle>> fdb_kvs_close fdb-check-error ;
TUPLE: fdb-file-handle < disposable handle ;
: <fdb-file-handle> ( handle -- obj )
fdb-file-handle new-disposable
swap >>handle ; inline
M: fdb-file-handle dispose*
handle>> fdb_close fdb-check-error ;
SYMBOL: current-fdb-file-handle
SYMBOL: current-fdb-kvs-handle
: get-file-handle ( -- handle )
current-fdb-file-handle get handle>> ;
: get-kvs-handle ( -- handle )
current-fdb-kvs-handle get handle>> ;
GENERIC: encode-kv ( object -- bytes )
M: string encode-kv utf8 encode ;
M: byte-array encode-kv ;
: fdb-set-kv ( key value -- )
[ get-kvs-handle ] 2dip
[ encode-kv dup length ] bi@ fdb_set_kv fdb-check-error ;
: <key-doc> ( key -- doc )
fdb_doc malloc-struct
swap [ utf8 malloc-string >>key ] [ length >>keylen ] bi ;
: <seqnum-doc> ( seqnum -- doc )
fdb_doc malloc-struct
swap >>seqnum ;
! Fill in document by exemplar
: fdb-get ( doc -- doc )
[ get-kvs-handle ] dip [ fdb_get fdb-check-error ] keep ;
: fdb-get-metaonly ( doc -- doc )
[ get-kvs-handle ] dip [ fdb_get_metaonly fdb-check-error ] keep ;
: fdb-get-byseq ( doc -- doc )
[ get-kvs-handle ] dip [ fdb_get_byseq fdb-check-error ] keep ;
: fdb-get-metaonly-byseq ( doc -- doc )
[ get-kvs-handle ] dip [ fdb_get_metaonly_byseq fdb-check-error ] keep ;
: fdb-get-byoffset ( doc -- doc )
[ get-kvs-handle ] dip [ fdb_get_byoffset fdb-check-error ] keep ;
! Set/delete documents
: fdb-set ( doc -- )
[ get-kvs-handle ] dip fdb_set fdb-check-error ;
: fdb-del ( doc -- )
[ get-kvs-handle ] dip fdb_del fdb-check-error ;
: ret>string ( void** len -- string )
[ void* deref ] [ size_t deref ] bi*
memory>byte-array utf8 decode ;
: fdb-get-kv ( key -- value/f )
[ get-kvs-handle ] dip
utf8 encode dup length f void* <ref> 0 size_t <ref>
[ fdb_get_kv ] 2keep
rot {
{ FDB_RESULT_SUCCESS [ ret>string ] }
{ FDB_RESULT_KEY_NOT_FOUND [ 2drop f ] }
[ fdb-error ]
} case ;
: fdb-del-kv ( key -- )
[ get-kvs-handle ] dip
utf8 encode dup length fdb_del_kv fdb-check-error ;
: fdb-doc-create ( key meta body -- doc )
[ f void* <ref> ] 3dip
[ utf8 encode dup length ] tri@
[ fdb_doc_create fdb-check-error ] 7 nkeep 6 ndrop
void* deref fdb_doc memory>struct ;
: fdb-doc-update ( doc meta body -- )
[ void* <ref> ] 2dip
[ utf8 encode dup length ] bi@
fdb_doc_update fdb-check-error ;
: fdb-doc-free ( doc -- )
fdb_doc_free fdb-check-error ;
: clear-doc-key ( doc -- doc )
[ dup [ (free) f ] when ] change-key
0 >>keylen ;
: with-doc ( doc quot: ( doc -- ) -- )
over '[ _ _ [ _ fdb-doc-free rethrow ] recover ] call ; inline
: with-create-doc ( key meta body quot: ( doc -- ) -- )
[ fdb-doc-create ] dip with-doc ; inline
: fdb-get-info ( -- fdb_file_info )
get-file-handle
fdb_file_info <struct> [ fdb_get_file_info fdb-check-error ] keep ;
: fdb-get-kvs-info ( -- fdb_kvs_info )
get-kvs-handle
fdb_kvs_info <struct> [ fdb_get_kvs_info fdb-check-error ] keep ;
: fdb-commit ( fdb_commit_opt_t -- )
[ get-file-handle ] dip fdb_commit fdb-check-error ;
: fdb-maybe-commit ( fdb_commit_opt_t/f -- )
[ fdb-commit ] when* ;
: fdb-commit-normal ( -- ) FDB_COMMIT_NORMAL fdb-commit ;
: fdb-commit-wal-flush ( -- ) FDB_COMMIT_MANUAL_WAL_FLUSH fdb-commit ;
: fdb-compact-to-path ( new-path -- )
[ get-file-handle ] dip absolute-path
fdb_compact fdb-check-error ;
: fdb-compact ( -- )
get-file-handle f fdb_compact fdb-check-error ;
: fdb-compact-commit-to-path ( path -- )
fdb-compact-to-path fdb-commit-wal-flush ;
: fdb-compact-commit ( -- )
fdb-compact fdb-commit-wal-flush ;
! Call from within with-foresdb
: fdb-open-snapshot ( seqnum -- handle )
[
get-kvs-handle
f void* <ref>
] dip [
fdb_snapshot_open fdb-check-error
] 2keep drop void* deref <fdb-kvs-handle> ;
! fdb_rollback returns a new handle, so we
! have to replace our current handle with that one
! XXX: can't call dispose on old handle, library handles that
: fdb-rollback ( seqnum -- )
[ get-kvs-handle void* <ref> ] dip
[ fdb_rollback fdb-check-error ] 2keep drop
void* deref <fdb-kvs-handle> current-fdb-kvs-handle set ;
TUPLE: fdb-iterator < disposable handle ;
: <fdb-iterator> ( handle -- obj )
fdb-iterator new-disposable
swap >>handle ; inline
M: fdb-iterator dispose*
handle>> fdb_iterator_close fdb-check-error ;
: fdb-iterator-init ( start-key end-key fdb_iterator_opt_t -- iterator )
[ get-kvs-handle f void* <ref> ] 3dip
[ [ utf8 encode dup length ] bi@ ] dip
[ fdb_iterator_init fdb-check-error ] 7 nkeep 5 ndrop nip
void* deref <fdb-iterator> ;
: fdb-iterator-byseq-init ( start-seq end-seq fdb_iterator_opt_t -- iterator )
[ get-kvs-handle f void* <ref> ] 3dip
[ fdb_iterator_sequence_init fdb-check-error ] 5 nkeep 3 ndrop nip
void* deref <fdb-iterator> ;
: fdb-iterator-init-none ( start-key end-key -- iterator )
FDB_ITR_NONE fdb-iterator-init ;
: fdb-iterator-no-deletes ( start-key end-key -- iterator )
FDB_ITR_NO_DELETES fdb-iterator-init ;
: check-iterate-result ( fdb_status -- ? )
{
{ FDB_RESULT_SUCCESS [ t ] }
{ FDB_RESULT_ITERATOR_FAIL [ f ] }
[ throw ]
} case ;
! fdb_doc key, meta, body only valid inside with-forestdb
! so make a helper word to preserve them outside
TUPLE: fdb-doc seqnum keylen key metalen meta bodylen body deleted? offset size-ondisk ;
CONSTRUCTOR: <fdb-doc> fdb-doc ( seqnum keylen key metalen meta bodylen body deleted? offset size-ondisk -- obj ) ;
TUPLE: fdb-info filename new-filename doc-count space-used file-size ;
CONSTRUCTOR: <info> fdb-info ( filename new-filename doc-count space-used file-size -- obj ) ;
![[
! Example fdb_doc and converted doc
S{ fdb_doc
{ keylen 4 } { metalen 0 } { bodylen 4 } { size_ondisk 0 }
{ key alien: 1002f2f10 } { seqnum 5 } { offset 4256 }
{ meta alien: 1002dc790 } { body f } { deleted f }
}
T{ doc
{ seqnum 5 }
{ keylen 4 } { key "key5" }
{ metalen 0 } { bodylen 4 }
{ offset 4256 } { size-ondisk 0 }
}
]]
: alien/length>string ( alien n -- string/f )
[ drop f ] [
over [
memory>byte-array utf8 decode
] [
2drop f
] if
] if-zero ;
: fdb_doc>doc ( fdb_doc -- doc )
{
[ seqnum>> ]
[ keylen>> ]
[ [ key>> ] [ keylen>> ] bi alien/length>string ]
[ metalen>> ]
[ [ meta>> ] [ metalen>> ] bi alien/length>string ]
[ bodylen>> ]
[ [ body>> ] [ bodylen>> ] bi alien/length>string ]
[ deleted>> >boolean ]
[ offset>> ]
[ size_ondisk>> ]
} cleave <fdb-doc> ;
: fdb_file_info>info ( fdb_doc -- doc )
{
[ filename>> alien>native-string ]
[ new_filename>> alien>native-string ]
[ doc_count>> ]
[ space_used>> ]
[ file_size>> ]
} cleave <info> ;
: fdb-iterator-get ( iterator -- doc/f )
f void* <ref>
[ fdb_iterator_get check-iterate-result ] keep swap
[ void* deref fdb_doc memory>struct ]
[ drop f ] if ;
: fdb-iterator-seek ( iterator key seek-opt -- )
[ dup length ] dip fdb_iterator_seek fdb-check-error ;
: fdb-iterator-seek-lower ( iterator key -- )
FDB_ITR_SEEK_LOWER fdb-iterator-seek ;
: fdb-iterator-seek-higher ( iterator key -- )
FDB_ITR_SEEK_HIGHER fdb-iterator-seek ;
: with-fdb-iterator ( start-key end-key fdb_iterator_opt_t iterator-init iterator-advance quot: ( obj -- ) -- )
[ execute ] 2dip
swap
'[
_ &dispose handle>> [
[ fdb-iterator-get ] keep swap
[ _ with-doc _ execute check-iterate-result ]
[ drop f ] if*
] curry loop
] with-destructors ; inline
<PRIVATE
: collector-when-as ( quot exemplar -- quot' vec )
[ length ] keep new-resizable [ [ over [ push ] [ 2drop ] if ] curry compose ] keep ; inline
: collector-when ( quot -- quot' vec )
V{ } collector-when-as ; inline
PRIVATE>
: get-kvs-default-config ( -- kvs-config )
fdb_get_default_kvs_config ;
: fdb-open ( path config -- file-handle )
[ f void* <ref> ] 2dip
[ make-parent-directories ] dip
[ fdb_open fdb-check-error ] 3keep
2drop void* deref <fdb-file-handle> ;
: fdb-config-normal-commit ( -- config )
fdb_get_default_config
FDB_SEQTREE_USE >>seqtree_opt ;
: fdb-config-auto-commit ( -- config )
fdb-config-normal-commit
FDB_COMPACTION_AUTO >>compaction_mode
1 >>compactor_sleep_duration
t >>auto_commit ;
! Make SEQTREES by default
: fdb-open-auto-commit ( path -- file-handle )
fdb-config-auto-commit fdb-open ;
: fdb-open-normal-commit ( path -- file-handle )
fdb-config-normal-commit fdb-open ;
: fdb-kvs-open-config ( name config -- kvs-handle )
[
current-fdb-file-handle get handle>>
f void* <ref>
] 2dip
[ fdb_kvs_open fdb-check-error ] 3keep 2drop
void* deref <fdb-kvs-handle> ;
: fdb-kvs-open-default-config ( name -- kvs-handle )
get-kvs-default-config fdb-kvs-open-config ;
: with-fdb-map ( start-key end-key fdb_iterator_opt_t iterator-init iterator-next quot: ( obj -- ) -- )
[ execute ] 2dip
swap
'[
_ &dispose handle>> [
[ fdb-iterator-get ] keep swap
[ _ with-doc swap _ execute check-iterate-result ]
[ drop f f ] if* swap
] curry collector-when [ loop ] dip
] with-destructors ; inline
: with-fdb-normal-iterator ( start-key end-key quot -- )
[ FDB_ITR_NONE \ fdb-iterator-init \ fdb_iterator_next ] dip
with-fdb-iterator ; inline
: with-fdb-byseq-each ( start-seq end-seq quot -- )
[ FDB_ITR_NONE \ fdb-iterator-byseq-init \ fdb_iterator_next ] dip
with-fdb-iterator ; inline
: with-fdb-byseq-map ( start-seq end-seq quot -- )
[ FDB_ITR_NONE \ fdb-iterator-byseq-init \ fdb_iterator_next ] dip
with-fdb-map ; inline
! : changes-cb ( handle doc ctx -- changes_decision )
! ;
! : fdb-changes-since ( seqnum iterator_opt cb ctx -- seq )
! f 101 FDB_ITR_NONE fdb_changes_since ;
: with-kvs-name-config ( name config quot -- )
'[
_ _ fdb-kvs-open-config &dispose current-fdb-kvs-handle _ with-variable
] with-destructors ; inline
: with-kvs-name ( name quot -- )
[ fdb_get_default_kvs_config ] dip with-kvs-name-config ; inline
: with-forestdb-file-handle ( path config quot -- )
'[
_ _ fdb-open &dispose current-fdb-file-handle _ with-variable
] with-destructors ; inline
: with-forestdb-path-config-kvs-name-config ( path config kvs-name kvs-config quot -- )
'[
_ _ with-kvs-name-config
] with-forestdb-file-handle ; inline
: with-forestdb-path-config-kvs-name ( path config kvs-name quot -- )
'[
_ _ with-kvs-name
] with-forestdb-file-handle ; inline
![[
! Do not try to commit here, as it will fail with FDB_RESULT_RONLY_VIOLATION
! fdb-current is weird, it gets replaced if you call fdb-rollback
! Therefore, only clean up fdb-current once, and clean it up at the end
: with-forestdb-handles ( file-handle handle quot fdb_commit_opt_t/f -- )
'[
_ current-fdb-file-handle [
_ current-fdb-kvs-handle [
[
@
_ fdb-maybe-commit
current-fdb-file-handle get &dispose drop
current-fdb-kvs-handle get &dispose drop
] [
[
current-fdb-file-handle get &dispose drop
current-fdb-kvs-handle get &dispose drop
] with-destructors
rethrow
] recover
] with-variable
] with-variable
] with-destructors ; inline
! XXX: When you don't commit-wal at the end of with-forestdb, it won't
! persist to disk for next time you open the db.
: with-forestdb-handles-commit-normal ( file-handle handle quot commit -- )
FDB_COMMIT_NORMAL with-forestdb-handles ; inline
: with-forestdb-handles-commit-wal ( file-handle handle quot commit -- )
FDB_COMMIT_MANUAL_WAL_FLUSH with-forestdb-handles ; inline
: with-forestdb-snapshot ( n quot -- )
[ fdb-open-snapshot ] dip '[
_ current-fdb-kvs-handle [
[
@
current-fdb-kvs-handle get &dispose drop
] [
current-fdb-kvs-handle get [ &dispose drop ] when*
rethrow
] recover
] with-variable
] with-destructors ; inline
: with-forestdb-path ( path quot -- )
[ absolute-path fdb-open-default-config ] dip with-forestdb-handles-commit-wal ; inline
! [ absolute-path fdb-open-default-config ] dip with-forestdb-handle-commit-normal ; inline
]]

View File

@ -1 +0,0 @@
Doug Coleman

View File

@ -1,39 +0,0 @@
! Copyright (C) 2014 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: forestdb.paths kernel tools.test ;
IN: forestdb.paths.tests
{ "1.fq.0" } [ "0.fq.0" next-vnode-name ] unit-test
{ "1.fq.0" } [ "0.fq.1" next-vnode-name ] unit-test
{ "100.fq.0" } [ "99.fq.0" next-vnode-name ] unit-test
{ "100.fq.0" } [ "99.fq.1" next-vnode-name ] unit-test
{ "100.fq.0" } [ "99.fq.20" next-vnode-name ] unit-test
{ "100.fq.0" } [ "099.fq.20" next-vnode-name ] unit-test
{ "0100.fq.0" } [ "0099.fq.20" next-vnode-name ] unit-test
{ "00001.fq.0" } [ "00000.fq.0" next-vnode-name ] unit-test
{ "001.fq.0" } [ "000.fq.1" next-vnode-name ] unit-test
{ "000100.fq.0" } [ "000099.fq.0" next-vnode-name ] unit-test
{ "00100.fq.0" } [ "00099.fq.1" next-vnode-name ] unit-test
{ "00000000100.fq.0" } [ "00000000099.fq.20" next-vnode-name ] unit-test
{ "0.fq.0" } [ "00.fq.00" canonical-fdb-name ] unit-test
{ "1.fq.0" } [ "01.fq.00" canonical-fdb-name ] unit-test
{ "0.fq.1" } [ "00.fq.01" canonical-fdb-name ] unit-test
{ "100.fq.10" } [ "000100.fq.010" canonical-fdb-name ] unit-test
{ "0.fq.1" } [ "0.fq.0" next-vnode-version-name ] unit-test
{ "0.fq.2" } [ "0.fq.1" next-vnode-version-name ] unit-test
{ "99.fq.1" } [ "99.fq.0" next-vnode-version-name ] unit-test
{ "99.fq.2" } [ "99.fq.1" next-vnode-version-name ] unit-test
{ "99.fq.21" } [ "99.fq.20" next-vnode-version-name ] unit-test
[ "fq" ensure-fdb-filename drop ] [ not-an-fdb-filename? ] must-fail-with
[ "0.fq" ensure-fdb-filename drop ] [ not-an-fdb-filename? ] must-fail-with
[ "0.fq." ensure-fdb-filename drop ] [ not-an-fdb-filename? ] must-fail-with
[ ".fq.0" ensure-fdb-filename drop ] [ not-an-fdb-filename? ] must-fail-with
[ "1fq.0" ensure-fdb-filename drop ] [ not-an-fdb-filename? ] must-fail-with
[ "1fq0" ensure-fdb-filename drop ] [ not-an-fdb-filename? ] must-fail-with
[ "1.fq0" ensure-fdb-filename drop ] [ not-an-fdb-filename? ] must-fail-with
[ "1.fq.0.0" ensure-fdb-filename drop ] [ not-an-fdb-filename? ] must-fail-with
[ "1.fq.00." ensure-fdb-filename drop ] [ not-an-fdb-filename? ] must-fail-with

View File

@ -1,76 +0,0 @@
! Copyright (C) 2014 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: arrays combinators.short-circuit combinators.smart
io.directories io.pathnames kernel math math.parser sequences
sorting sorting.human splitting sets ;
IN: forestdb.paths
CONSTANT: fdb-filename-base "fq"
: fdb-filename? ( path -- ? )
"." split {
[ length 3 = ]
[ second fdb-filename-base = ]
[ first string>number ]
[ third string>number ]
} 1&& ;
ERROR: not-an-fdb-filename string ;
: ensure-fdb-filename ( string -- string )
dup fdb-filename? [ not-an-fdb-filename ] unless ;
ERROR: not-a-string-number string ;
: ?string>number ( string -- n )
dup string>number [ ] [ not-a-string-number ] ?if ;
: change-string-number ( string quot -- string' )
[ [ string>number ] dip call number>string ] 2keep drop
length char: 0 pad-head ; inline
: next-vnode-name ( string -- string' )
[
"." split
first [ 1 + ] change-string-number
"." fdb-filename-base ".0"
] "" append-outputs-as ;
: trim-head-zeros ( string -- string' )
[ char: 0 = ] trim-head 1 char: 0 pad-head ;
: canonical-fdb-name ( string -- string' )
ensure-fdb-filename
"." split first3
[ trim-head-zeros ]
[ ]
[ trim-head-zeros ] tri* 3array "." join ;
: next-vnode-version-name ( string -- string' )
"." split
[ but-last "." join ]
[ last [ 1 + ] change-string-number ] bi "." glue ;
: path>next-vnode-path ( path -- path' )
dup directory-files
[ fdb-filename? ] filter
[ human<=> ] sort [
fdb-filename-base "0." ".0" surround append-path
] [
last "." split first [ 1 + ] change-string-number
".fq.0" append append-path
] if-empty ;
: path-has-fdb? ( path -- ? )
directory-files [ fdb-filename? ] filter length 0 > ;
: path-only-fdb? ( path -- ? )
directory-files
[ length ]
[ [ fdb-filename? ] filter length ] bi = ;
: path-fdb-duplicates ( path -- seq )
directory-files [ canonical-fdb-name ] map members ;
! : path>next-vnode-version-name ( path -- path' )
! [ file-name ]

View File

@ -1 +0,0 @@
Doug Coleman

View File

@ -1,69 +0,0 @@
! Copyright (C) 2014 Doug Coleman.
! See http://factorcode.org/license.txt for BSD license.
USING: accessors assocs continuations forestdb.ffi forestdb.lib
fry io.directories io.files.temp io.files.unique
io.files.unique.private io.pathnames kernel locals math.parser
math.ranges namespaces sequences splitting ;
IN: forestdb.utils
: fdb-test-config-seqtree-auto ( -- config )
fdb_get_default_config
FDB_COMPACTION_AUTO >>compaction_mode
FDB_SEQTREE_USE >>seqtree_opt ;
: fdb-test-config-seqtree-manual ( -- config )
fdb_get_default_config
FDB_COMPACTION_MANUAL >>compaction_mode
FDB_SEQTREE_USE >>seqtree_opt ;
! Manual naming scheme: foo.db
: do-forestdb-test-db-manual ( config quot -- )
'[
"forestdb-test-manual" ".db" [
_
"default" _ with-forestdb-path-config-kvs-name
] cleanup-unique-file
] with-temp-directory ; inline
! Auto naming scheme: foo.db.0 foo.db.meta
: do-forestdb-test-db-auto ( config quot -- )
'[
"forestdb-test-auto" { ".db.0" ".db.meta" } [
first ".0" ?tail drop
_ "default" _ with-forestdb-path-config-kvs-name
] cleanup-unique-files
] with-temp-directory ; inline
: with-forestdb-test-db ( config quot -- )
over [
do-forestdb-test-db-manual
] [
do-forestdb-test-db-auto
] if ; inline
: with-forestdb-test-manual ( quot -- )
[ fdb-test-config-seqtree-manual ] dip do-forestdb-test-db-manual ; inline
: with-forestdb-test-auto ( quot -- )
[ fdb-test-config-seqtree-auto ] dip do-forestdb-test-db-auto ; inline
: make-kv-nth ( n -- key val )
number>string [ "key" prepend ] [ "val" prepend ] bi ;
: make-kv-n ( n -- seq )
[1,b] [ make-kv-nth ] { } map>assoc ;
: make-kv-range ( a b -- seq )
[a,b] [ make-kv-nth ] { } map>assoc ;
: set-kv-n ( n -- )
make-kv-n [ fdb-set-kv ] assoc-each ;
: del-kv-n ( n -- )
make-kv-n keys [ fdb-del-kv ] each ;
: set-kv-nth ( n -- )
make-kv-nth fdb-set-kv ;
: set-kv-range ( a b -- )
make-kv-range [ fdb-set-kv ] assoc-each ;

View File

@ -1,7 +1,7 @@
USING: accessors arrays assocs calendar calendar.format calendar.parser
combinators continuations destructors formatting fry grouping.extras imap
imap.private io.streams.duplex kernel math math.parser math.ranges
namespaces random sequences sets sorting uuid
namespaces random sequences sets sorting uuid multiline
splitting strings system tools.test memoize combinators.smart ;
FROM: pcre => findall ;
IN: imap.tests
@ -45,6 +45,9 @@ MEMO: my-uuid ( -- str )
base-folder "/" my-uuid "/" _
] "" append-outputs-as ;
![[
{ t } [
get-test-host <imap4ssl> [ duplex-stream? ] with-disposal
] unit-test
@ -64,7 +67,7 @@ MEMO: my-uuid ( -- str )
] unit-test
! Try to reset test folder before starting tests
[ ] [
{ } [
[ "foo/bar/baz/日本語" test-folder delete-folder ] ignore-errors
[ "foo/bar/baz/boo" test-folder delete-folder ] ignore-errors
[ "foo/bar/baz" test-folder delete-folder ] ignore-errors
@ -78,7 +81,7 @@ MEMO: my-uuid ( -- str )
{ } [ \ imap-settings get-global [ ] with-imap-settings ] unit-test
! Newly created and then selected folder is empty.
[ 0 { } ] [
{ 0 { } } [
10 random-ascii
[ create-folder ]
[ select-folder ]
@ -87,19 +90,19 @@ MEMO: my-uuid ( -- str )
] imap-test
! Create delete select again.
[ 0 ] [
{ 0 } [
"örjan" test-folder
[ create-folder ] [ select-folder ] [ delete-folder ] tri
] imap-test
! Test list folders
[ t ] [
{ t } [
10 random-ascii
[ create-folder "*" list-folders length 0 > ] [ delete-folder ] bi
] imap-test
! Generate some mails for searching
[ t t f f ] [
{ t t f f } [
10 random-ascii {
[ create-folder ]
[
@ -119,7 +122,7 @@ MEMO: my-uuid ( -- str )
] imap-test
! Stat folder
[ t ] [
{ t } [
10 random-ascii {
[ create-folder ]
[
@ -135,7 +138,7 @@ MEMO: my-uuid ( -- str )
] imap-test
! Rename folder
[ ] [
{ } [
"日本語" test-folder [ create-folder ] [
"ascii-name" test-folder
[ rename-folder ] [ delete-folder ] bi
@ -143,7 +146,7 @@ MEMO: my-uuid ( -- str )
] imap-test
! Create a folder hierarchy
[ t ] [
{ t } [
"foo/bar/baz/日本語" test-folder
[ '[ _ delete-folder ] ignore-errors ]
[
@ -155,13 +158,13 @@ MEMO: my-uuid ( -- str )
] imap-test
! A gmail compliant way of creating a folder hierarchy.
[ ] [
{ } [
"foo/bar/baz/boo" test-folder "/" split
{ } [ suffix ] accumulate* [ "/" join ] map
[ [ create-folder ] each ] [ [ delete-folder ] each ] bi
] imap-test
[ ] [
{ } [
"örjan" test-folder {
[ create-folder ]
[ select-folder drop ]
@ -174,7 +177,7 @@ MEMO: my-uuid ( -- str )
] imap-test
! Exercise store-mail
[ 5 ] [
{ 5 } [
"INBOX" select-folder drop "ALL" "" search-mails
5 sample "+FLAGS" "(\\Recent)" store-mail length
] imap-test
@ -189,7 +192,7 @@ MEMO: my-uuid ( -- str )
] unit-test
! Test parsing an INTERNALDATE from a real mail.
[ t ] [
{ t } [
"INBOX" select-folder drop
"ALL" "" search-mails
"(INTERNALDATE)" fetch-mails first
@ -215,3 +218,5 @@ MEMO: my-uuid ( -- str )
] map
] [ "(BODY[HEADER.FIELDS (SUBJECT)])" fetch-mails ] bi zip
[ first first ] [ sort-with ] [ group-by ] bi ;
]]

View File

@ -130,7 +130,7 @@ IN: io.streams.peek.tests
] unit-test
! Issue #1317
{ "Red" } [
{ "Cop" } [
"resource:LICENSE.txt" binary [
input-stream [ <peek-stream> ] change
peek1 drop
@ -138,7 +138,7 @@ IN: io.streams.peek.tests
] with-file-reader
] unit-test
{ "ist" } [
{ "yri" } [
"resource:LICENSE.txt" binary [
input-stream [ <peek-stream> ] change
peek1 drop

View File

@ -2,22 +2,6 @@ USING: io io.pathnames kernel mason.child mason.config
namespaces sequences system tools.test ;
IN: mason.child.tests
{ { "make" "macosx-x86-32" } } [
H{
{ target-os macosx }
{ target-cpu x86.32 }
} [ mason-child-make-cmd ] with-variables
] unit-test
! Must be an absolute path on Windows because launch directory
! is relative to parent directory (instead of current directory).
{ t } [
H{
{ target-os windows }
{ target-cpu x86.32 }
} [ mason-child-make-cmd ] with-variables first absolute-path?
] unit-test
{ t } [
H{
{ target-os windows }

View File

@ -2,32 +2,33 @@
! See http://factorcode.org/license.txt for BSD license.
USING: accessors arrays calendar combinators
combinators.short-circuit continuations fry io.directories
io.launcher io.pathnames kernel macros make mason.config
mason.notify mason.platform mason.report namespaces quotations
sequences splitting system ;
io.launcher io.pathnames kernel layouts macros make mason.config
mason.notify mason.platform mason.report math.parser namespaces
quotations sequences splitting system system-info ;
IN: mason.child
! Make sure we call the build directory's factor.cmd
: nmake-cmd ( -- args )
"./build.cmd" absolute-path
"latest"
target-cpu get name>> "." split "-" join 3array ;
: gnu-make-cmd ( -- args )
gnu-make
target-os get name>> target-cpu get name>> (platform)
2array ;
: mason-child-make-cmd ( -- args )
{
{ [ target-os get windows = ] [ nmake-cmd ] }
[ gnu-make-cmd ]
} cond ;
HOOK: compile-factor-command os ( -- array )
M: unix compile-factor-command ( -- array )
gnu-make-cmd ;
! Windows has separate 32/64 bit shells, so assuming the cell bits here is fine
! because it won't find the right toolchain otherwise.
M: windows compile-factor-command ( -- array )
{ "nmake" "/f" "NMakefile" } cell-bits 64 = "x86-64" "x86-32" ? suffix ;
HOOK: factor-path os ( -- path )
M: unix factor-path "./factor" ;
M: windows factor-path "./factor.com" ;
: make-mason-child-vm ( -- )
"factor" [
<process>
mason-child-make-cmd >>command
compile-factor-command >>command
"../compile-log" >>stdout
+stdout+ >>stderr
+new-group+ >>group
@ -72,7 +73,7 @@ IN: mason.child
+closed+ >>stdin
"../test-log" >>stdout
+stdout+ >>stderr
4 hours >>timeout
6 hours >>timeout
+new-group+ >>group
try-process
] with-directory ;

View File

@ -1,6 +1,7 @@
USING: io.directories io.directories.hierarchy io.files
io.files.temp kernel mason.common mason.config mason.report
namespaces tools.test xml xml.writer ;
IN: mason.report.tests
USING: io.files io.files.temp io.directories io.directories.hierarchy kernel
mason.report mason.common mason.config namespaces tools.test xml xml.writer ;
{ 0 0 } [ [ ] with-report ] must-infer-as

View File

@ -2,7 +2,7 @@
! See http://factorcode.org/license.txt for BSD license.
USING: assocs combinators.smart debugger fry io.encodings.utf8
io.files io.streams.string kernel literals locals mason.common
mason.config mason.disk math math.parser namespaces sequences
mason.config mason.disk mason.test math namespaces sequences
xml.syntax xml.writer ;
IN: mason.report
@ -129,7 +129,7 @@ IN: mason.report
error-dump
benchmarks-file eval-file benchmarks-table
] output>array
] output>array sift
] with-report ;
: build-clean? ( -- ? )

View File

@ -118,14 +118,14 @@ PY-METHODS: code =>
100000 [
[ [ 987 >py basename drop ] ignore-errors ] with-destructors
] times
] unit-test
] long-unit-test
! Another leaky test
{ } [
1000000 [
[ { 9 8 7 6 5 4 3 2 1 } >py ] with-destructors drop
] times
] unit-test
] long-unit-test
! Working with types
PY-QUALIFIED-FROM: types => UnicodeType ( -- ) ;

View File

@ -1,20 +1,22 @@
Copyright (c) 2017, Slava Pestov, et al.
All rights reserved.
Redistribution and use in source and binary forms, with or without
modification, are permitted provided that the following conditions are met:
1. Redistributions of source code must retain the above copyright notice,
this list of conditions and the following disclaimer.
1. Redistributions of source code must retain the above copyright notice, this
list of conditions and the following disclaimer.
2. Redistributions in binary form must reproduce the above copyright notice,
this list of conditions and the following disclaimer in the documentation
and/or other materials provided with the distribution.
THIS SOFTWARE IS PROVIDED ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES,
INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND
FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
DEVELOPERS AND CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS;
OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY,
WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR
OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND
ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED
WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR
ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES
(INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES;
LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND
ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
(INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.