Summary: Removed scribe, thrift and java modules. Test Plan: make release make check Reviewers: emayanke Reviewed By: emayanke CC: leveldb Differential Revision: https://reviews.facebook.net/D13293main
parent
aad2110823
commit
0a9f873f4b
@ -1,20 +0,0 @@ |
|||||||
############################################################################### |
|
||||||
leveldb - A Java port of LevelDB (https://github.com/dain/leveldb) |
|
||||||
|
|
||||||
This is a Java port of LevelDB. We only need the interface part, so the |
|
||||||
implementation part is not checked in. |
|
||||||
|
|
||||||
This is based on commit: c8d074b3d95f30612e573bba689b85749031d639 from |
|
||||||
https://github.com/dain/leveldb.git |
|
||||||
|
|
||||||
############################################################################### |
|
||||||
|
|
||||||
leveldbjni - JNI Wrapper for LevelDB (https://github.com/fusesource/leveldbjni) |
|
||||||
|
|
||||||
Provide LevelDB implementation by using JNI wrapper. It is written using HawtJNI |
|
||||||
which is JNI code generatori (http://hawtjni.fusesource.org/). |
|
||||||
|
|
||||||
This is based on commmit: 8bac93ec1bcc97a098a1eaac265ea04b766ef574 from |
|
||||||
https://github.com/fusesource/leveldbjni.git |
|
||||||
|
|
||||||
############################################################################### |
|
@ -1,22 +0,0 @@ |
|||||||
target/ |
|
||||||
/var |
|
||||||
pom.xml.versionsBackup |
|
||||||
test-output/ |
|
||||||
/atlassian-ide-plugin.x |
|
||||||
.idea |
|
||||||
.*.swp |
|
||||||
.*.swo |
|
||||||
leveldb-c |
|
||||||
*~ |
|
||||||
*.swp |
|
||||||
.idea |
|
||||||
.idea/* |
|
||||||
*.iml |
|
||||||
*.ipr |
|
||||||
*.iws |
|
||||||
.DS_Store |
|
||||||
.scala_dependencies |
|
||||||
.project |
|
||||||
.classpath |
|
||||||
.settings |
|
||||||
eclipse-classes |
|
@ -1,19 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion> |
|
||||||
<parent> |
|
||||||
<groupId>org.iq80.leveldb</groupId> |
|
||||||
<artifactId>leveldb-project</artifactId> |
|
||||||
<version>0.4-SNAPSHOT</version> |
|
||||||
</parent> |
|
||||||
|
|
||||||
<groupId>org.iq80.leveldb</groupId> |
|
||||||
<artifactId>leveldb-api</artifactId> |
|
||||||
<version>0.4-SNAPSHOT</version> |
|
||||||
<packaging>jar</packaging> |
|
||||||
|
|
||||||
<name>${project.artifactId}</name> |
|
||||||
<description>High level Java API for LevelDB</description> |
|
||||||
|
|
||||||
</project> |
|
@ -1,45 +0,0 @@ |
|||||||
/** |
|
||||||
* Copyright (C) 2011 the original author or authors. |
|
||||||
* See the notice.md file distributed with this work for additional |
|
||||||
* information regarding copyright ownership. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.iq80.leveldb; |
|
||||||
|
|
||||||
public enum CompressionType |
|
||||||
{ |
|
||||||
NONE(0x00), |
|
||||||
SNAPPY(0x01); |
|
||||||
|
|
||||||
public static CompressionType getCompressionTypeByPersistentId(int persistentId) { |
|
||||||
for (CompressionType compressionType : CompressionType.values()) { |
|
||||||
if (compressionType.persistentId == persistentId) { |
|
||||||
return compressionType; |
|
||||||
} |
|
||||||
} |
|
||||||
throw new IllegalArgumentException("Unknown persistentId " + persistentId); |
|
||||||
} |
|
||||||
|
|
||||||
private final int persistentId; |
|
||||||
|
|
||||||
CompressionType(int persistentId) |
|
||||||
{ |
|
||||||
this.persistentId = persistentId; |
|
||||||
} |
|
||||||
|
|
||||||
public int persistentId() |
|
||||||
{ |
|
||||||
return persistentId; |
|
||||||
} |
|
||||||
} |
|
@ -1,62 +0,0 @@ |
|||||||
/** |
|
||||||
* Copyright (C) 2011 the original author or authors. |
|
||||||
* See the notice.md file distributed with this work for additional |
|
||||||
* information regarding copyright ownership. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.iq80.leveldb; |
|
||||||
|
|
||||||
import java.io.Closeable; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public interface DB extends Iterable<Map.Entry<byte[], byte[]>>, Closeable { |
|
||||||
|
|
||||||
public byte[] get(byte[] key) throws DBException; |
|
||||||
public byte[] get(byte[] key, ReadOptions options) throws DBException; |
|
||||||
|
|
||||||
public DBIterator iterator(); |
|
||||||
public DBIterator iterator(ReadOptions options); |
|
||||||
|
|
||||||
public void put(byte[] key, byte[] value) throws DBException; |
|
||||||
public void delete(byte[] key) throws DBException; |
|
||||||
public void write(WriteBatch updates) throws DBException; |
|
||||||
|
|
||||||
public WriteBatch createWriteBatch(); |
|
||||||
|
|
||||||
/** |
|
||||||
* @return null if options.isSnapshot()==false otherwise returns a snapshot |
|
||||||
* of the DB after this operation. |
|
||||||
*/ |
|
||||||
public Snapshot put(byte[] key, byte[] value, WriteOptions options) throws DBException; |
|
||||||
|
|
||||||
/** |
|
||||||
* @return null if options.isSnapshot()==false otherwise returns a snapshot |
|
||||||
* of the DB after this operation. |
|
||||||
*/ |
|
||||||
public Snapshot delete(byte[] key, WriteOptions options) throws DBException; |
|
||||||
|
|
||||||
/** |
|
||||||
* @return null if options.isSnapshot()==false otherwise returns a snapshot |
|
||||||
* of the DB after this operation. |
|
||||||
*/ |
|
||||||
public Snapshot write(WriteBatch updates, WriteOptions options) throws DBException; |
|
||||||
|
|
||||||
public Snapshot getSnapshot(); |
|
||||||
|
|
||||||
public long[] getApproximateSizes(Range ... ranges); |
|
||||||
public String getProperty(String name); |
|
||||||
} |
|
@ -1,47 +0,0 @@ |
|||||||
/** |
|
||||||
* Copyright (C) 2011 the original author or authors. |
|
||||||
* See the notice.md file distributed with this work for additional |
|
||||||
* information regarding copyright ownership. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.iq80.leveldb; |
|
||||||
|
|
||||||
import java.util.Comparator; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public interface DBComparator extends Comparator<byte[]>{ |
|
||||||
|
|
||||||
public String name(); |
|
||||||
|
|
||||||
/** |
|
||||||
* If <code>start < limit</code>, returns a short key in [start,limit). |
|
||||||
* Simple comparator implementations should return start unchanged, |
|
||||||
* |
|
||||||
* @param start |
|
||||||
* @param limit |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
byte[] findShortestSeparator(byte[] start, byte[] limit); |
|
||||||
|
|
||||||
/** |
|
||||||
* returns a 'short key' where the 'short key' >= key. |
|
||||||
* Simple comparator implementations should return key unchanged, |
|
||||||
* |
|
||||||
* @param key |
|
||||||
*/ |
|
||||||
byte[] findShortSuccessor(byte[] key); |
|
||||||
|
|
||||||
} |
|
@ -1,38 +0,0 @@ |
|||||||
/** |
|
||||||
* Copyright (C) 2011 the original author or authors. |
|
||||||
* See the notice.md file distributed with this work for additional |
|
||||||
* information regarding copyright ownership. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.iq80.leveldb; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class DBException extends RuntimeException { |
|
||||||
public DBException() { |
|
||||||
} |
|
||||||
|
|
||||||
public DBException(String s) { |
|
||||||
super(s); |
|
||||||
} |
|
||||||
|
|
||||||
public DBException(String s, Throwable throwable) { |
|
||||||
super(s, throwable); |
|
||||||
} |
|
||||||
|
|
||||||
public DBException(Throwable throwable) { |
|
||||||
super(throwable); |
|
||||||
} |
|
||||||
} |
|
@ -1,34 +0,0 @@ |
|||||||
/** |
|
||||||
* Copyright (C) 2011 the original author or authors. |
|
||||||
* See the notice.md file distributed with this work for additional |
|
||||||
* information regarding copyright ownership. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.iq80.leveldb; |
|
||||||
|
|
||||||
import java.io.File; |
|
||||||
import java.io.IOException; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public interface DBFactory { |
|
||||||
|
|
||||||
public DB open(File path, Options options) throws IOException; |
|
||||||
|
|
||||||
public void destroy(File path, Options options) throws IOException; |
|
||||||
|
|
||||||
public void repair(File path, Options options) throws IOException; |
|
||||||
|
|
||||||
} |
|
@ -1,65 +0,0 @@ |
|||||||
/** |
|
||||||
* Copyright (C) 2011 the original author or authors. |
|
||||||
* See the notice.md file distributed with this work for additional |
|
||||||
* information regarding copyright ownership. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.iq80.leveldb; |
|
||||||
|
|
||||||
import java.io.Closeable; |
|
||||||
import java.util.Iterator; |
|
||||||
import java.util.Map; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public interface DBIterator extends Iterator<Map.Entry<byte[], byte[]>>, Closeable { |
|
||||||
|
|
||||||
/** |
|
||||||
* Repositions the iterator so the key of the next BlockElement |
|
||||||
* returned greater than or equal to the specified targetKey. |
|
||||||
*/ |
|
||||||
public void seek(byte[] key); |
|
||||||
|
|
||||||
/** |
|
||||||
* Repositions the iterator so is is at the beginning of the Database. |
|
||||||
*/ |
|
||||||
public void seekToFirst(); |
|
||||||
|
|
||||||
/** |
|
||||||
* Returns the next element in the iteration, without advancing the iteration. |
|
||||||
*/ |
|
||||||
public Map.Entry<byte[], byte[]> peekNext(); |
|
||||||
|
|
||||||
/** |
|
||||||
* @return true if there is a previous entry in the iteration. |
|
||||||
*/ |
|
||||||
boolean hasPrev(); |
|
||||||
|
|
||||||
/** |
|
||||||
* @return the previous element in the iteration and rewinds the iteration. |
|
||||||
*/ |
|
||||||
Map.Entry<byte[], byte[]> prev(); |
|
||||||
|
|
||||||
/** |
|
||||||
* @return the previous element in the iteration, without rewinding the iteration. |
|
||||||
*/ |
|
||||||
public Map.Entry<byte[], byte[]> peekPrev(); |
|
||||||
|
|
||||||
/** |
|
||||||
* Repositions the iterator so it is at the end of of the Database. |
|
||||||
*/ |
|
||||||
public void seekToLast(); |
|
||||||
|
|
||||||
} |
|
@ -1,27 +0,0 @@ |
|||||||
/** |
|
||||||
* Copyright (C) 2011 the original author or authors. |
|
||||||
* See the notice.md file distributed with this work for additional |
|
||||||
* information regarding copyright ownership. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.iq80.leveldb; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public interface Logger { |
|
||||||
|
|
||||||
public void log(String message); |
|
||||||
|
|
||||||
} |
|
@ -1,168 +0,0 @@ |
|||||||
/** |
|
||||||
* Copyright (C) 2011 the original author or authors. |
|
||||||
* See the notice.md file distributed with this work for additional |
|
||||||
* information regarding copyright ownership. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.iq80.leveldb; |
|
||||||
|
|
||||||
public class Options { |
|
||||||
|
|
||||||
private boolean createIfMissing = true; |
|
||||||
private boolean errorIfExists; |
|
||||||
private int writeBufferSize = 4 << 20; |
|
||||||
|
|
||||||
private int maxOpenFiles = 1000; |
|
||||||
|
|
||||||
private int blockRestartInterval = 16; |
|
||||||
private int blockSize = 4 * 1024; |
|
||||||
private CompressionType compressionType = CompressionType.SNAPPY; |
|
||||||
private boolean verifyChecksums = true; |
|
||||||
private boolean paranoidChecks = false; |
|
||||||
private DBComparator comparator; |
|
||||||
private Logger logger = null; |
|
||||||
private long cacheSize; |
|
||||||
|
|
||||||
static void checkArgNotNull(Object value, String name) { |
|
||||||
if(value==null) { |
|
||||||
throw new IllegalArgumentException("The "+name+" argument cannot be null"); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public boolean createIfMissing() |
|
||||||
{ |
|
||||||
return createIfMissing; |
|
||||||
} |
|
||||||
|
|
||||||
public Options createIfMissing(boolean createIfMissing) |
|
||||||
{ |
|
||||||
this.createIfMissing = createIfMissing; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean errorIfExists() |
|
||||||
{ |
|
||||||
return errorIfExists; |
|
||||||
} |
|
||||||
|
|
||||||
public Options errorIfExists(boolean errorIfExists) |
|
||||||
{ |
|
||||||
this.errorIfExists = errorIfExists; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int writeBufferSize() |
|
||||||
{ |
|
||||||
return writeBufferSize; |
|
||||||
} |
|
||||||
|
|
||||||
public Options writeBufferSize(int writeBufferSize) |
|
||||||
{ |
|
||||||
this.writeBufferSize = writeBufferSize; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int maxOpenFiles() |
|
||||||
{ |
|
||||||
return maxOpenFiles; |
|
||||||
} |
|
||||||
|
|
||||||
public Options maxOpenFiles(int maxOpenFiles) |
|
||||||
{ |
|
||||||
this.maxOpenFiles = maxOpenFiles; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int blockRestartInterval() |
|
||||||
{ |
|
||||||
return blockRestartInterval; |
|
||||||
} |
|
||||||
|
|
||||||
public Options blockRestartInterval(int blockRestartInterval) |
|
||||||
{ |
|
||||||
this.blockRestartInterval = blockRestartInterval; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int blockSize() |
|
||||||
{ |
|
||||||
return blockSize; |
|
||||||
} |
|
||||||
|
|
||||||
public Options blockSize(int blockSize) |
|
||||||
{ |
|
||||||
this.blockSize = blockSize; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public CompressionType compressionType() |
|
||||||
{ |
|
||||||
return compressionType; |
|
||||||
} |
|
||||||
|
|
||||||
public Options compressionType(CompressionType compressionType) |
|
||||||
{ |
|
||||||
checkArgNotNull(compressionType, "compressionType"); |
|
||||||
this.compressionType = compressionType; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean verifyChecksums() |
|
||||||
{ |
|
||||||
return verifyChecksums; |
|
||||||
} |
|
||||||
|
|
||||||
public Options verifyChecksums(boolean verifyChecksums) |
|
||||||
{ |
|
||||||
this.verifyChecksums = verifyChecksums; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public long cacheSize() { |
|
||||||
return cacheSize; |
|
||||||
} |
|
||||||
|
|
||||||
public Options cacheSize(long cacheSize) { |
|
||||||
this.cacheSize = cacheSize; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public DBComparator comparator() { |
|
||||||
return comparator; |
|
||||||
} |
|
||||||
|
|
||||||
public Options comparator(DBComparator comparator) { |
|
||||||
this.comparator = comparator; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public Logger logger() { |
|
||||||
return logger; |
|
||||||
} |
|
||||||
|
|
||||||
public Options logger(Logger logger) { |
|
||||||
this.logger = logger; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean paranoidChecks() { |
|
||||||
return paranoidChecks; |
|
||||||
} |
|
||||||
|
|
||||||
public Options paranoidChecks(boolean paranoidChecks) { |
|
||||||
this.paranoidChecks = paranoidChecks; |
|
||||||
return this; |
|
||||||
} |
|
||||||
} |
|
@ -1,43 +0,0 @@ |
|||||||
/** |
|
||||||
* Copyright (C) 2011 the original author or authors. |
|
||||||
* See the notice.md file distributed with this work for additional |
|
||||||
* information regarding copyright ownership. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.iq80.leveldb; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class Range { |
|
||||||
|
|
||||||
final private byte[] start; |
|
||||||
final private byte[] limit; |
|
||||||
|
|
||||||
public byte[] limit() { |
|
||||||
return limit; |
|
||||||
} |
|
||||||
|
|
||||||
public byte[] start() { |
|
||||||
return start; |
|
||||||
} |
|
||||||
|
|
||||||
public Range(byte[] start, byte[] limit) { |
|
||||||
Options.checkArgNotNull(start, "start"); |
|
||||||
Options.checkArgNotNull(limit, "limit"); |
|
||||||
this.limit = limit; |
|
||||||
this.start = start; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,54 +0,0 @@ |
|||||||
/** |
|
||||||
* Copyright (C) 2011 the original author or authors. |
|
||||||
* See the notice.md file distributed with this work for additional |
|
||||||
* information regarding copyright ownership. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.iq80.leveldb; |
|
||||||
|
|
||||||
public class ReadOptions |
|
||||||
{ |
|
||||||
private boolean verifyChecksums = false; |
|
||||||
private boolean fillCache = true; |
|
||||||
private Snapshot snapshot; |
|
||||||
|
|
||||||
public Snapshot snapshot() |
|
||||||
{ |
|
||||||
return snapshot; |
|
||||||
} |
|
||||||
|
|
||||||
public ReadOptions snapshot(Snapshot snapshot) |
|
||||||
{ |
|
||||||
this.snapshot = snapshot; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean fillCache() { |
|
||||||
return fillCache; |
|
||||||
} |
|
||||||
|
|
||||||
public ReadOptions fillCache(boolean fillCache) { |
|
||||||
this.fillCache = fillCache; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean verifyChecksums() { |
|
||||||
return verifyChecksums; |
|
||||||
} |
|
||||||
|
|
||||||
public ReadOptions verifyChecksums(boolean verifyChecksums) { |
|
||||||
this.verifyChecksums = verifyChecksums; |
|
||||||
return this; |
|
||||||
} |
|
||||||
} |
|
@ -1,24 +0,0 @@ |
|||||||
/** |
|
||||||
* Copyright (C) 2011 the original author or authors. |
|
||||||
* See the notice.md file distributed with this work for additional |
|
||||||
* information regarding copyright ownership. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.iq80.leveldb; |
|
||||||
|
|
||||||
import java.io.Closeable; |
|
||||||
|
|
||||||
public interface Snapshot extends Closeable { |
|
||||||
|
|
||||||
} |
|
@ -1,29 +0,0 @@ |
|||||||
/** |
|
||||||
* Copyright (C) 2011 the original author or authors. |
|
||||||
* See the notice.md file distributed with this work for additional |
|
||||||
* information regarding copyright ownership. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.iq80.leveldb; |
|
||||||
|
|
||||||
import java.io.Closeable; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public interface WriteBatch extends Closeable { |
|
||||||
|
|
||||||
public WriteBatch put(byte[] key, byte[] value); |
|
||||||
public WriteBatch delete(byte[] key); |
|
||||||
} |
|
@ -1,46 +0,0 @@ |
|||||||
/** |
|
||||||
* Copyright (C) 2011 the original author or authors. |
|
||||||
* See the notice.md file distributed with this work for additional |
|
||||||
* information regarding copyright ownership. |
|
||||||
* |
|
||||||
* Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
* you may not use this file except in compliance with the License. |
|
||||||
* You may obtain a copy of the License at |
|
||||||
* |
|
||||||
* http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
* |
|
||||||
* Unless required by applicable law or agreed to in writing, software |
|
||||||
* distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
* See the License for the specific language governing permissions and |
|
||||||
* limitations under the License. |
|
||||||
*/ |
|
||||||
package org.iq80.leveldb; |
|
||||||
|
|
||||||
public class WriteOptions |
|
||||||
{ |
|
||||||
private boolean sync; |
|
||||||
private boolean snapshot; |
|
||||||
|
|
||||||
|
|
||||||
public boolean sync() |
|
||||||
{ |
|
||||||
return sync; |
|
||||||
} |
|
||||||
|
|
||||||
public WriteOptions sync(boolean sync) |
|
||||||
{ |
|
||||||
this.sync = sync; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean snapshot() { |
|
||||||
return snapshot; |
|
||||||
} |
|
||||||
|
|
||||||
public WriteOptions snapshot(boolean snapshot) { |
|
||||||
this.snapshot = snapshot; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,15 +0,0 @@ |
|||||||
Copyright (C) 2011 the original author or authors. |
|
||||||
See the notice.md file distributed with this work for additional |
|
||||||
information regarding copyright ownership. |
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
you may not use this file except in compliance with the License. |
|
||||||
You may obtain a copy of the License at |
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software |
|
||||||
distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
See the License for the specific language governing permissions and |
|
||||||
limitations under the License. |
|
@ -1,203 +0,0 @@ |
|||||||
|
|
||||||
Apache License |
|
||||||
Version 2.0, January 2004 |
|
||||||
http://www.apache.org/licenses/ |
|
||||||
|
|
||||||
TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION |
|
||||||
|
|
||||||
1. Definitions. |
|
||||||
|
|
||||||
"License" shall mean the terms and conditions for use, reproduction, |
|
||||||
and distribution as defined by Sections 1 through 9 of this document. |
|
||||||
|
|
||||||
"Licensor" shall mean the copyright owner or entity authorized by |
|
||||||
the copyright owner that is granting the License. |
|
||||||
|
|
||||||
"Legal Entity" shall mean the union of the acting entity and all |
|
||||||
other entities that control, are controlled by, or are under common |
|
||||||
control with that entity. For the purposes of this definition, |
|
||||||
"control" means (i) the power, direct or indirect, to cause the |
|
||||||
direction or management of such entity, whether by contract or |
|
||||||
otherwise, or (ii) ownership of fifty percent (50%) or more of the |
|
||||||
outstanding shares, or (iii) beneficial ownership of such entity. |
|
||||||
|
|
||||||
"You" (or "Your") shall mean an individual or Legal Entity |
|
||||||
exercising permissions granted by this License. |
|
||||||
|
|
||||||
"Source" form shall mean the preferred form for making modifications, |
|
||||||
including but not limited to software source code, documentation |
|
||||||
source, and configuration files. |
|
||||||
|
|
||||||
"Object" form shall mean any form resulting from mechanical |
|
||||||
transformation or translation of a Source form, including but |
|
||||||
not limited to compiled object code, generated documentation, |
|
||||||
and conversions to other media types. |
|
||||||
|
|
||||||
"Work" shall mean the work of authorship, whether in Source or |
|
||||||
Object form, made available under the License, as indicated by a |
|
||||||
copyright notice that is included in or attached to the work |
|
||||||
(an example is provided in the Appendix below). |
|
||||||
|
|
||||||
"Derivative Works" shall mean any work, whether in Source or Object |
|
||||||
form, that is based on (or derived from) the Work and for which the |
|
||||||
editorial revisions, annotations, elaborations, or other modifications |
|
||||||
represent, as a whole, an original work of authorship. For the purposes |
|
||||||
of this License, Derivative Works shall not include works that remain |
|
||||||
separable from, or merely link (or bind by name) to the interfaces of, |
|
||||||
the Work and Derivative Works thereof. |
|
||||||
|
|
||||||
"Contribution" shall mean any work of authorship, including |
|
||||||
the original version of the Work and any modifications or additions |
|
||||||
to that Work or Derivative Works thereof, that is intentionally |
|
||||||
submitted to Licensor for inclusion in the Work by the copyright owner |
|
||||||
or by an individual or Legal Entity authorized to submit on behalf of |
|
||||||
the copyright owner. For the purposes of this definition, "submitted" |
|
||||||
means any form of electronic, verbal, or written communication sent |
|
||||||
to the Licensor or its representatives, including but not limited to |
|
||||||
communication on electronic mailing lists, source code control systems, |
|
||||||
and issue tracking systems that are managed by, or on behalf of, the |
|
||||||
Licensor for the purpose of discussing and improving the Work, but |
|
||||||
excluding communication that is conspicuously marked or otherwise |
|
||||||
designated in writing by the copyright owner as "Not a Contribution." |
|
||||||
|
|
||||||
"Contributor" shall mean Licensor and any individual or Legal Entity |
|
||||||
on behalf of whom a Contribution has been received by Licensor and |
|
||||||
subsequently incorporated within the Work. |
|
||||||
|
|
||||||
2. Grant of Copyright License. Subject to the terms and conditions of |
|
||||||
this License, each Contributor hereby grants to You a perpetual, |
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
|
||||||
copyright license to reproduce, prepare Derivative Works of, |
|
||||||
publicly display, publicly perform, sublicense, and distribute the |
|
||||||
Work and such Derivative Works in Source or Object form. |
|
||||||
|
|
||||||
3. Grant of Patent License. Subject to the terms and conditions of |
|
||||||
this License, each Contributor hereby grants to You a perpetual, |
|
||||||
worldwide, non-exclusive, no-charge, royalty-free, irrevocable |
|
||||||
(except as stated in this section) patent license to make, have made, |
|
||||||
use, offer to sell, sell, import, and otherwise transfer the Work, |
|
||||||
where such license applies only to those patent claims licensable |
|
||||||
by such Contributor that are necessarily infringed by their |
|
||||||
Contribution(s) alone or by combination of their Contribution(s) |
|
||||||
with the Work to which such Contribution(s) was submitted. If You |
|
||||||
institute patent litigation against any entity (including a |
|
||||||
cross-claim or counterclaim in a lawsuit) alleging that the Work |
|
||||||
or a Contribution incorporated within the Work constitutes direct |
|
||||||
or contributory patent infringement, then any patent licenses |
|
||||||
granted to You under this License for that Work shall terminate |
|
||||||
as of the date such litigation is filed. |
|
||||||
|
|
||||||
4. Redistribution. You may reproduce and distribute copies of the |
|
||||||
Work or Derivative Works thereof in any medium, with or without |
|
||||||
modifications, and in Source or Object form, provided that You |
|
||||||
meet the following conditions: |
|
||||||
|
|
||||||
(a) You must give any other recipients of the Work or |
|
||||||
Derivative Works a copy of this License; and |
|
||||||
|
|
||||||
(b) You must cause any modified files to carry prominent notices |
|
||||||
stating that You changed the files; and |
|
||||||
|
|
||||||
(c) You must retain, in the Source form of any Derivative Works |
|
||||||
that You distribute, all copyright, patent, trademark, and |
|
||||||
attribution notices from the Source form of the Work, |
|
||||||
excluding those notices that do not pertain to any part of |
|
||||||
the Derivative Works; and |
|
||||||
|
|
||||||
(d) If the Work includes a "NOTICE" text file as part of its |
|
||||||
distribution, then any Derivative Works that You distribute must |
|
||||||
include a readable copy of the attribution notices contained |
|
||||||
within such NOTICE file, excluding those notices that do not |
|
||||||
pertain to any part of the Derivative Works, in at least one |
|
||||||
of the following places: within a NOTICE text file distributed |
|
||||||
as part of the Derivative Works; within the Source form or |
|
||||||
documentation, if provided along with the Derivative Works; or, |
|
||||||
within a display generated by the Derivative Works, if and |
|
||||||
wherever such third-party notices normally appear. The contents |
|
||||||
of the NOTICE file are for informational purposes only and |
|
||||||
do not modify the License. You may add Your own attribution |
|
||||||
notices within Derivative Works that You distribute, alongside |
|
||||||
or as an addendum to the NOTICE text from the Work, provided |
|
||||||
that such additional attribution notices cannot be construed |
|
||||||
as modifying the License. |
|
||||||
|
|
||||||
You may add Your own copyright statement to Your modifications and |
|
||||||
may provide additional or different license terms and conditions |
|
||||||
for use, reproduction, or distribution of Your modifications, or |
|
||||||
for any such Derivative Works as a whole, provided Your use, |
|
||||||
reproduction, and distribution of the Work otherwise complies with |
|
||||||
the conditions stated in this License. |
|
||||||
|
|
||||||
5. Submission of Contributions. Unless You explicitly state otherwise, |
|
||||||
any Contribution intentionally submitted for inclusion in the Work |
|
||||||
by You to the Licensor shall be under the terms and conditions of |
|
||||||
this License, without any additional terms or conditions. |
|
||||||
Notwithstanding the above, nothing herein shall supersede or modify |
|
||||||
the terms of any separate license agreement you may have executed |
|
||||||
with Licensor regarding such Contributions. |
|
||||||
|
|
||||||
6. Trademarks. This License does not grant permission to use the trade |
|
||||||
names, trademarks, service marks, or product names of the Licensor, |
|
||||||
except as required for reasonable and customary use in describing the |
|
||||||
origin of the Work and reproducing the content of the NOTICE file. |
|
||||||
|
|
||||||
7. Disclaimer of Warranty. Unless required by applicable law or |
|
||||||
agreed to in writing, Licensor provides the Work (and each |
|
||||||
Contributor provides its Contributions) on an "AS IS" BASIS, |
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or |
|
||||||
implied, including, without limitation, any warranties or conditions |
|
||||||
of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A |
|
||||||
PARTICULAR PURPOSE. You are solely responsible for determining the |
|
||||||
appropriateness of using or redistributing the Work and assume any |
|
||||||
risks associated with Your exercise of permissions under this License. |
|
||||||
|
|
||||||
8. Limitation of Liability. In no event and under no legal theory, |
|
||||||
whether in tort (including negligence), contract, or otherwise, |
|
||||||
unless required by applicable law (such as deliberate and grossly |
|
||||||
negligent acts) or agreed to in writing, shall any Contributor be |
|
||||||
liable to You for damages, including any direct, indirect, special, |
|
||||||
incidental, or consequential damages of any character arising as a |
|
||||||
result of this License or out of the use or inability to use the |
|
||||||
Work (including but not limited to damages for loss of goodwill, |
|
||||||
work stoppage, computer failure or malfunction, or any and all |
|
||||||
other commercial damages or losses), even if such Contributor |
|
||||||
has been advised of the possibility of such damages. |
|
||||||
|
|
||||||
9. Accepting Warranty or Additional Liability. While redistributing |
|
||||||
the Work or Derivative Works thereof, You may choose to offer, |
|
||||||
and charge a fee for, acceptance of support, warranty, indemnity, |
|
||||||
or other liability obligations and/or rights consistent with this |
|
||||||
License. However, in accepting such obligations, You may act only |
|
||||||
on Your own behalf and on Your sole responsibility, not on behalf |
|
||||||
of any other Contributor, and only if You agree to indemnify, |
|
||||||
defend, and hold each Contributor harmless for any liability |
|
||||||
incurred by, or claims asserted against, such Contributor by reason |
|
||||||
of your accepting any such warranty or additional liability. |
|
||||||
|
|
||||||
END OF TERMS AND CONDITIONS |
|
||||||
|
|
||||||
APPENDIX: How to apply the Apache License to your work. |
|
||||||
|
|
||||||
To apply the Apache License to your work, attach the following |
|
||||||
boilerplate notice, with the fields enclosed by brackets "[]" |
|
||||||
replaced with your own identifying information. (Don't include |
|
||||||
the brackets!) The text should be enclosed in the appropriate |
|
||||||
comment syntax for the file format. We also recommend that a |
|
||||||
file or class name and description of purpose be included on the |
|
||||||
same "printed page" as the copyright notice for easier |
|
||||||
identification within third-party archives. |
|
||||||
|
|
||||||
Copyright [yyyy] [name of copyright owner] |
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
you may not use this file except in compliance with the License. |
|
||||||
You may obtain a copy of the License at |
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software |
|
||||||
distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
See the License for the specific language governing permissions and |
|
||||||
limitations under the License. |
|
||||||
|
|
@ -1,5 +0,0 @@ |
|||||||
LevelDB Copyright Notices |
|
||||||
========================= |
|
||||||
|
|
||||||
* Copyright 2011 Dain Sundstrom <dain@iq80.com> |
|
||||||
* Copyright 2011 FuseSource Corp. http://fusesource.com |
|
@ -1,386 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd"> |
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion> |
|
||||||
|
|
||||||
<groupId>org.iq80.leveldb</groupId> |
|
||||||
<artifactId>leveldb-project</artifactId> |
|
||||||
<version>0.4-SNAPSHOT</version> |
|
||||||
<packaging>pom</packaging> |
|
||||||
|
|
||||||
<name>${project.artifactId}</name> |
|
||||||
|
|
||||||
<description>Port of LevelDB to Java</description> |
|
||||||
<url>http://github.com/dain/leveldb</url> |
|
||||||
|
|
||||||
<modules> |
|
||||||
<module>leveldb-api</module> |
|
||||||
<module>leveldb</module> |
|
||||||
</modules> |
|
||||||
|
|
||||||
<inceptionYear>2011</inceptionYear> |
|
||||||
|
|
||||||
<licenses> |
|
||||||
<license> |
|
||||||
<name>Apache License 2.0</name> |
|
||||||
<url>http://www.apache.org/licenses/LICENSE-2.0.html</url> |
|
||||||
<distribution>repo</distribution> |
|
||||||
</license> |
|
||||||
</licenses> |
|
||||||
|
|
||||||
<developers> |
|
||||||
<developer> |
|
||||||
<id>dain</id> |
|
||||||
<name>Dain Sundstrom</name> |
|
||||||
<email>dain@iq80.com</email> |
|
||||||
</developer> |
|
||||||
<developer> |
|
||||||
<id>chirino</id> |
|
||||||
<name>Hiram Chirino</name> |
|
||||||
<email>hiram@hiramchirino.com</email> |
|
||||||
<url>http://hiramchirino.com</url> |
|
||||||
<timezone>-5</timezone> |
|
||||||
</developer> |
|
||||||
</developers> |
|
||||||
|
|
||||||
<properties> |
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|
||||||
<sonatypeOssDistMgmtSnapshotsUrl>https://oss.sonatype.org/content/repositories/snapshots/</sonatypeOssDistMgmtSnapshotsUrl> |
|
||||||
</properties> |
|
||||||
|
|
||||||
<scm> |
|
||||||
<connection>scm:git:git://github.com/dain/leveldb.git</connection> |
|
||||||
<developerConnection>scm:git:git@github.com:dain/leveldb.git</developerConnection> |
|
||||||
<url>http://github.com/dain/leveldb/tree/master</url> |
|
||||||
</scm> |
|
||||||
|
|
||||||
<prerequisites> |
|
||||||
<maven>3.0</maven> |
|
||||||
</prerequisites> |
|
||||||
|
|
||||||
<repositories> |
|
||||||
<repository> |
|
||||||
<id>sonatype-nexus-snapshots</id> |
|
||||||
<name>Sonatype Nexus Snapshots</name> |
|
||||||
<url>https://oss.sonatype.org/content/repositories/snapshots</url> |
|
||||||
<releases> |
|
||||||
<enabled>false</enabled> |
|
||||||
</releases> |
|
||||||
<snapshots> |
|
||||||
<enabled>true</enabled> |
|
||||||
</snapshots> |
|
||||||
</repository> |
|
||||||
</repositories> |
|
||||||
|
|
||||||
<distributionManagement> |
|
||||||
<snapshotRepository> |
|
||||||
<id>sonatype-nexus-snapshots</id> |
|
||||||
<name>Sonatype Nexus Snapshots</name> |
|
||||||
<url>${sonatypeOssDistMgmtSnapshotsUrl}</url> |
|
||||||
</snapshotRepository> |
|
||||||
<repository> |
|
||||||
<id>sonatype-nexus-staging</id> |
|
||||||
<name>Nexus Release Repository</name> |
|
||||||
<url>https://oss.sonatype.org/service/local/staging/deploy/maven2/</url> |
|
||||||
</repository> |
|
||||||
</distributionManagement> |
|
||||||
|
|
||||||
<build> |
|
||||||
<plugins> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-enforcer-plugin</artifactId> |
|
||||||
<version>1.0</version> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<id>enforce-versions</id> |
|
||||||
<goals> |
|
||||||
<goal>enforce</goal> |
|
||||||
</goals> |
|
||||||
<configuration> |
|
||||||
<rules> |
|
||||||
<requireMavenVersion> |
|
||||||
<version>3.0.0</version> |
|
||||||
</requireMavenVersion> |
|
||||||
<requireJavaVersion> |
|
||||||
<version>1.6</version> |
|
||||||
</requireJavaVersion> |
|
||||||
</rules> |
|
||||||
</configuration> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
</plugin> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-source-plugin</artifactId> |
|
||||||
</plugin> |
|
||||||
</plugins> |
|
||||||
|
|
||||||
<pluginManagement> |
|
||||||
<plugins> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-surefire-plugin</artifactId> |
|
||||||
<version>2.8.1</version> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-source-plugin</artifactId> |
|
||||||
<version>2.1.2</version> |
|
||||||
<configuration> |
|
||||||
<attach>true</attach> |
|
||||||
</configuration> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<id>create-source-jar</id> |
|
||||||
<goals> |
|
||||||
<goal>jar-no-fork</goal> |
|
||||||
</goals> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-compiler-plugin</artifactId> |
|
||||||
<version>2.3.2</version> |
|
||||||
<configuration> |
|
||||||
<source>1.6</source> |
|
||||||
<target>1.6</target> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.codehaus.mojo</groupId> |
|
||||||
<artifactId>findbugs-maven-plugin</artifactId> |
|
||||||
<version>2.3.2</version> |
|
||||||
<configuration> |
|
||||||
<findbugsXmlOutput>true</findbugsXmlOutput> |
|
||||||
<findbugsXmlWithMessages>true</findbugsXmlWithMessages> |
|
||||||
<xmlOutput>true</xmlOutput> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.codehaus.mojo</groupId> |
|
||||||
<artifactId>cobertura-maven-plugin</artifactId> |
|
||||||
<version>2.4</version> |
|
||||||
<configuration> |
|
||||||
<formats> |
|
||||||
<format>xml</format> |
|
||||||
</formats> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-install-plugin</artifactId> |
|
||||||
<version>2.3.1</version> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-resources-plugin</artifactId> |
|
||||||
<version>2.4.3</version> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-deploy-plugin</artifactId> |
|
||||||
<version>2.5</version> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-javadoc-plugin</artifactId> |
|
||||||
<version>2.7</version> |
|
||||||
<configuration> |
|
||||||
<docletArtifact> |
|
||||||
<groupId>com.google.doclava</groupId> |
|
||||||
<artifactId>doclava</artifactId> |
|
||||||
<version>1.0.3</version> |
|
||||||
</docletArtifact> |
|
||||||
<doclet>com.google.doclava.Doclava</doclet> |
|
||||||
<!-- |
|
||||||
| bootclasspath required by Sun's JVM |
|
||||||
--> |
|
||||||
<bootclasspath>${sun.boot.class.path}</bootclasspath> |
|
||||||
<additionalparam> |
|
||||||
-quiet |
|
||||||
<!-- The federation options cause an NPE when it builds the project pom --> |
|
||||||
<!-- |
|
||||||
-federate JDK http://download.oracle.com/javase/6/docs/api/index.html? |
|
||||||
-federationxml JDK http://doclava.googlecode.com/svn/static/api/openjdk-6.xml |
|
||||||
-federate Guice http://google-guice.googlecode.com/svn/trunk/javadoc/ |
|
||||||
--> |
|
||||||
-hdf project.name "${project.name}" |
|
||||||
-d ${project.build.directory}/apidocs |
|
||||||
</additionalparam> |
|
||||||
<useStandardDocletOptions>false</useStandardDocletOptions> |
|
||||||
<!-- |
|
||||||
| Apple's JVM sometimes requires more memory |
|
||||||
--> |
|
||||||
<additionalJOption>-J-Xmx1024m</additionalJOption> |
|
||||||
</configuration> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<id>attach-javadocs</id> |
|
||||||
<goals> |
|
||||||
<goal>jar</goal> |
|
||||||
</goals> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-release-plugin</artifactId> |
|
||||||
<version>2.2.1</version> |
|
||||||
<configuration> |
|
||||||
<mavenExecutorId>forked-path</mavenExecutorId> |
|
||||||
<useReleaseProfile>false</useReleaseProfile> |
|
||||||
<arguments>-Psonatype-oss-release</arguments> |
|
||||||
<pushChanges>false</pushChanges> |
|
||||||
<localCheckout>true</localCheckout> |
|
||||||
<tagNameFormat>@{project.version}</tagNameFormat> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<!-- |
|
||||||
Do a license check by running : mvn license:check |
|
||||||
Update the license check by running : mvn license:format |
|
||||||
--> |
|
||||||
<plugin> |
|
||||||
<groupId>com.mycila.maven-license-plugin</groupId> |
|
||||||
<artifactId>maven-license-plugin</artifactId> |
|
||||||
<version>1.9.0</version> |
|
||||||
<configuration> |
|
||||||
<header>license-header.txt</header> |
|
||||||
<excludes> |
|
||||||
<exclude>**/README.txt</exclude> |
|
||||||
<exclude>**/config.properties</exclude> |
|
||||||
<exclude>**/log.properties</exclude> |
|
||||||
</excludes> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-site-plugin</artifactId> |
|
||||||
<version>3.0</version> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<id>attach-descriptor</id> |
|
||||||
<goals> |
|
||||||
<goal>attach-descriptor</goal> |
|
||||||
</goals> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
<configuration> |
|
||||||
<reportPlugins> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-project-info-reports-plugin</artifactId> |
|
||||||
<version>2.4</version> |
|
||||||
<configuration> |
|
||||||
<dependencyDetailsEnabled>false</dependencyDetailsEnabled> |
|
||||||
<dependencyLocationsEnabled>false</dependencyLocationsEnabled> |
|
||||||
</configuration> |
|
||||||
<!-- simpler configuration without reportSets available for usual cases --> |
|
||||||
<reports> |
|
||||||
<report>index</report> |
|
||||||
<report>dependencies</report> |
|
||||||
<report>issue-tracking</report> |
|
||||||
<report>license</report> |
|
||||||
<report>mailing-list</report> |
|
||||||
<report>modules</report> |
|
||||||
<report>project-team</report> |
|
||||||
<report>plugin-management</report> |
|
||||||
<report>plugins</report> |
|
||||||
<report>scm</report> |
|
||||||
</reports> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-jxr-plugin</artifactId> |
|
||||||
<version>2.3</version> |
|
||||||
<configuration> |
|
||||||
<!-- <stylesheet>stylesheet.css</stylesheet> --> |
|
||||||
<inputEncoding>UTF-8</inputEncoding> |
|
||||||
<outputEncoding>UTF-8</outputEncoding> |
|
||||||
<linkJavadoc>true</linkJavadoc> |
|
||||||
<docTitle>${project.name} Source Xref (${project.version})</docTitle> |
|
||||||
<windowTitle>${project.name} Source Xref (${project.version})</windowTitle> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-javadoc-plugin</artifactId> |
|
||||||
<version>2.7</version> |
|
||||||
<configuration> |
|
||||||
<docletArtifact> |
|
||||||
<groupId>com.google.doclava</groupId> |
|
||||||
<artifactId>doclava</artifactId> |
|
||||||
<version>1.0.3</version> |
|
||||||
</docletArtifact> |
|
||||||
<doclet>com.google.doclava.Doclava</doclet> |
|
||||||
<!-- |
|
||||||
| bootclasspath required by Sun's JVM |
|
||||||
--> |
|
||||||
<bootclasspath>${sun.boot.class.path}</bootclasspath> |
|
||||||
<additionalparam> |
|
||||||
-quiet |
|
||||||
<!-- The federation options cause an NPE when it builds the project pom --> |
|
||||||
<!-- |
|
||||||
-federate JDK http://download.oracle.com/javase/6/docs/api/index.html? |
|
||||||
-federationxml JDK http://doclava.googlecode.com/svn/static/api/openjdk-6.xml |
|
||||||
-federate Guice http://google-guice.googlecode.com/svn/trunk/javadoc/ |
|
||||||
--> |
|
||||||
-hdf project.name "${project.name}" |
|
||||||
-d ${project.build.directory}/site/apidocs |
|
||||||
</additionalparam> |
|
||||||
<useStandardDocletOptions>false</useStandardDocletOptions> |
|
||||||
<!-- |
|
||||||
| Apple's JVM sometimes requires more memory |
|
||||||
--> |
|
||||||
<additionalJOption>-J-Xmx1024m</additionalJOption> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
</reportPlugins> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
</plugins> |
|
||||||
</pluginManagement> |
|
||||||
</build> |
|
||||||
|
|
||||||
<profiles> |
|
||||||
<profile> |
|
||||||
<id>sonatype-oss-release</id> |
|
||||||
<build> |
|
||||||
<plugins> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-gpg-plugin</artifactId> |
|
||||||
<version>1.1</version> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<id>sign-artifacts</id> |
|
||||||
<phase>verify</phase> |
|
||||||
<goals> |
|
||||||
<goal>sign</goal> |
|
||||||
</goals> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
</plugin> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-javadoc-plugin</artifactId> |
|
||||||
</plugin> |
|
||||||
</plugins> |
|
||||||
</build> |
|
||||||
</profile> |
|
||||||
</profiles> |
|
||||||
</project> |
|
@ -1,41 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!-- |
|
||||||
Copyright (C) 2011 the original author or authors. |
|
||||||
See the notice.md file distributed with this work for additional |
|
||||||
information regarding copyright ownership. |
|
||||||
|
|
||||||
Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
you may not use this file except in compliance with the License. |
|
||||||
You may obtain a copy of the License at |
|
||||||
|
|
||||||
http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
|
|
||||||
Unless required by applicable law or agreed to in writing, software |
|
||||||
distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
See the License for the specific language governing permissions and |
|
||||||
limitations under the License. |
|
||||||
--> |
|
||||||
<project name="${project.name}"> |
|
||||||
|
|
||||||
<skin> |
|
||||||
<groupId>com.googlecode.fluido-skin</groupId> |
|
||||||
<artifactId>fluido-skin</artifactId> |
|
||||||
<version>1.3</version> |
|
||||||
</skin> |
|
||||||
|
|
||||||
<!-- Enable if the project ever gets a logo. |
|
||||||
<bannerLeft> |
|
||||||
<name>${project.name}</name> |
|
||||||
<src>http://github.com/dain/leveldb/tree/master/ ...... /project-logo.png</src> |
|
||||||
<href>${project.url}</href> |
|
||||||
</bannerLeft> |
|
||||||
--> |
|
||||||
|
|
||||||
<version position="left"/> |
|
||||||
<body> |
|
||||||
<menu ref="reports" inherit="bottom"/> |
|
||||||
<menu ref="modules" inherit="bottom"/> |
|
||||||
</body> |
|
||||||
|
|
||||||
</project> |
|
@ -1,13 +0,0 @@ |
|||||||
*~ |
|
||||||
*.swp |
|
||||||
.idea |
|
||||||
.idea/* |
|
||||||
*.iml |
|
||||||
*.ipr |
|
||||||
*.iws |
|
||||||
target |
|
||||||
.DS_Store |
|
||||||
.project |
|
||||||
.classpath |
|
||||||
.settings |
|
||||||
eclipse-classes |
|
@ -1,49 +0,0 @@ |
|||||||
# [LevelDBJNI](https://github.com/fusesource/leveldbjni) |
|
||||||
|
|
||||||
## [leveldbjni 1.4][1_4], released 2012-10-31 |
|
||||||
[1_4]: http://repo.fusesource.com/nexus/content/groups/public/org/fusesource/leveldbjni/leveldbjni/1.4 |
|
||||||
|
|
||||||
* Switch to leveldb-api version 0.4 |
|
||||||
* Checking the results of autotool chain into the source tree so that folks building don't have to have the autotools installed. |
|
||||||
* Support suspending the background compaction thread. |
|
||||||
|
|
||||||
## [leveldbjni 1.3][1_3], released 2012-09-24 |
|
||||||
[1_3]: http://repo.fusesource.com/nexus/content/groups/public/org/fusesource/leveldbjni/leveldbjni/1.3 |
|
||||||
|
|
||||||
* Make Util.link work on windows too. |
|
||||||
* Expose the CreateHardLinkW windows API call. |
|
||||||
* Added Windows LevelDB Support |
|
||||||
* Update to hawtjni 1.6. |
|
||||||
* Support the db.compactRange method to force compaction of the leveldb files. |
|
||||||
* Fixed bug need to get leveldbjni workin on the Zing JVM |
|
||||||
|
|
||||||
## [leveldbjni 1.2][1_2], released 2012-02-27 |
|
||||||
[1_2]: http://repo.fusesource.com/nexus/content/groups/public/org/fusesource/leveldbjni/leveldbjni/1.2 |
|
||||||
|
|
||||||
* Document how to use the memory pools. |
|
||||||
* Fixes issue #6 Support using a memory pool to reduce native memory allocation overhead. |
|
||||||
* Update leveldb, hawtjni, and leveldb-api versions. |
|
||||||
* Store the version in the factory class. |
|
||||||
* Added a release guide. |
|
||||||
|
|
||||||
## [leveldbjni 1.1][1_1], released 2011-09-29 |
|
||||||
[1_1]: http://repo.fusesource.com/nexus/content/groups/public/org/fusesource/leveldbjni/leveldbjni/1.1 |
|
||||||
|
|
||||||
* the all module needs at least one java file so that it produces a javadoc and src.zip |
|
||||||
* Try to load the native lib when the JniDBFactory class is loaded. |
|
||||||
* Fixes issue #1 : Bug on NativeBuffer offset |
|
||||||
* Switch the license from CDDL to the New BSD license to match the license used in the leveldb project. |
|
||||||
* Add the sonatype snapshot repo since that's where the leveldb-api is at currently. |
|
||||||
* Pickup updates in the api module. |
|
||||||
* Updating build instructions. |
|
||||||
* implement repair and destroy. |
|
||||||
* api updated |
|
||||||
* Cleaner java package structure. We only need to expose one public class now since we are using the org.iq80.leveldb abstract api. |
|
||||||
* Refactored so that the main user API is the abstract API defined in 'org.iq80.leveldb.api' package. |
|
||||||
|
|
||||||
## [leveldbjni 1.0][1_0], released 2011-08-08 |
|
||||||
[1_0]: http://repo.fusesource.com/nexus/content/groups/public/org/fusesource/leveldbjni/leveldbjni/1.0 |
|
||||||
|
|
||||||
* Initial Release |
|
||||||
* OS X Intel 32 and 64 bit support |
|
||||||
* Linux Intel 32 and 64 bit support |
|
@ -1,30 +0,0 @@ |
|||||||
From 3f0a7d241d96e8dc40ebf8001e4c41aa4ff86472 Mon Sep 17 00:00:00 2001
|
|
||||||
From: Abhishek Kona <abhishekk@fb.com>
|
|
||||||
Date: Tue, 11 Dec 2012 22:38:14 -0800
|
|
||||||
Subject: [PATCH] patch to make it compilable with java
|
|
||||||
|
|
||||||
---
|
|
||||||
include/leveldb/db.h | 5 ++++-
|
|
||||||
1 file changed, 4 insertions(+), 1 deletion(-)
|
|
||||||
|
|
||||||
diff --git a/include/leveldb/db.h b/include/leveldb/db.h
|
|
||||||
index 2cfa537..e84685b 100644
|
|
||||||
--- a/include/leveldb/db.h
|
|
||||||
+++ b/include/leveldb/db.h
|
|
||||||
@@ -182,9 +182,12 @@ class DB {
|
|
||||||
virtual Status GetLiveFiles(std::vector<std::string>&,
|
|
||||||
uint64_t* manifest_file_size) = 0;
|
|
||||||
|
|
||||||
- // The sequence number of the most recent transaction.
|
|
||||||
+ // The sequence number of the most recent transaction.
|
|
||||||
virtual SequenceNumber GetLatestSequenceNumber() = 0;
|
|
||||||
|
|
||||||
+ virtual void SuspendCompactions() {};
|
|
||||||
+ virtual void ResumeCompactions() {};
|
|
||||||
+
|
|
||||||
// Return's an iterator for all writes since the sequence number
|
|
||||||
// Status::ok if iterator is valid.
|
|
||||||
// The iterator internally holds references to the available log files.
|
|
||||||
--
|
|
||||||
1.7.11.1
|
|
||||||
|
|
@ -1,95 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!-- |
|
||||||
Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
|
|
||||||
http://fusesource.com |
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without |
|
||||||
modification, are permitted provided that the following conditions are |
|
||||||
met: |
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright |
|
||||||
notice, this list of conditions and the following disclaimer. |
|
||||||
* 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. |
|
||||||
* Neither the name of FuseSource Corp. nor the names of its |
|
||||||
contributors may be used to endorse or promote products derived from |
|
||||||
this software without specific prior written permission. |
|
||||||
|
|
||||||
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. |
|
||||||
--> |
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion> |
|
||||||
<parent> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-project</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</parent> |
|
||||||
|
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-all</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
|
|
||||||
<name>${project.artifactId}</name> |
|
||||||
<description>An uber jar which contains all the leveldbjni platform libraries and dependencies</description> |
|
||||||
|
|
||||||
<dependencies> |
|
||||||
<dependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-osx</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</dependency> |
|
||||||
<dependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-linux32</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</dependency> |
|
||||||
<dependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-linux64</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</dependency> |
|
||||||
<dependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-win32</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</dependency> |
|
||||||
<dependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-win64</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</dependency> |
|
||||||
|
|
||||||
</dependencies> |
|
||||||
|
|
||||||
<build> |
|
||||||
|
|
||||||
<plugins> |
|
||||||
<plugin> |
|
||||||
<groupId>org.fusesource.mvnplugins</groupId> |
|
||||||
<artifactId>maven-uberize-plugin</artifactId> |
|
||||||
<version>1.15</version> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<phase>package</phase> |
|
||||||
<goals><goal>uberize</goal></goals> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
</plugin> |
|
||||||
</plugins> |
|
||||||
</build> |
|
||||||
|
|
||||||
</project> |
|
@ -1,4 +0,0 @@ |
|||||||
package org.fusesource.leveldbjni; |
|
||||||
|
|
||||||
public class All { |
|
||||||
} |
|
@ -1,100 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!-- |
|
||||||
Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
|
|
||||||
http://fusesource.com |
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without |
|
||||||
modification, are permitted provided that the following conditions are |
|
||||||
met: |
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright |
|
||||||
notice, this list of conditions and the following disclaimer. |
|
||||||
* 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. |
|
||||||
* Neither the name of FuseSource Corp. nor the names of its |
|
||||||
contributors may be used to endorse or promote products derived from |
|
||||||
this software without specific prior written permission. |
|
||||||
|
|
||||||
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. |
|
||||||
--> |
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion> |
|
||||||
<parent> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-project</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</parent> |
|
||||||
|
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-linux32</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
|
|
||||||
<name>${project.artifactId}</name> |
|
||||||
<description>The leveldbjni linux 32 native libraries</description> |
|
||||||
|
|
||||||
<dependencies> |
|
||||||
<dependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</dependency> |
|
||||||
</dependencies> |
|
||||||
|
|
||||||
<build> |
|
||||||
<testSourceDirectory>${basedir}/../leveldbjni/src/test/java</testSourceDirectory> |
|
||||||
|
|
||||||
<plugins> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-jar-plugin</artifactId> |
|
||||||
<version>2.3.1</version> |
|
||||||
<configuration> |
|
||||||
<classesDirectory>${basedir}/target/generated-sources/hawtjni/lib</classesDirectory> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
<plugin> |
|
||||||
<groupId>org.fusesource.hawtjni</groupId> |
|
||||||
<artifactId>maven-hawtjni-plugin</artifactId> |
|
||||||
<version>${hawtjni-version}</version> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<goals> |
|
||||||
<goal>build</goal> |
|
||||||
</goals> |
|
||||||
<phase>compile</phase> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
<configuration> |
|
||||||
<name>leveldbjni</name> |
|
||||||
<classified>false</classified> |
|
||||||
<nativeSrcDependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni</artifactId> |
|
||||||
<version>${project.version}</version> |
|
||||||
<classifier>native-src</classifier> |
|
||||||
<type>zip</type> |
|
||||||
</nativeSrcDependency> |
|
||||||
<configureArgs> |
|
||||||
<arg>--with-leveldb=${env.LEVELDB_HOME}</arg> |
|
||||||
<arg>--with-snappy=${env.SNAPPY_HOME}</arg> |
|
||||||
</configureArgs> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
</plugins> |
|
||||||
</build> |
|
||||||
|
|
||||||
</project> |
|
@ -1,99 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!-- |
|
||||||
Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
|
|
||||||
http://fusesource.com |
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without |
|
||||||
modification, are permitted provided that the following conditions are |
|
||||||
met: |
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright |
|
||||||
notice, this list of conditions and the following disclaimer. |
|
||||||
* 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. |
|
||||||
* Neither the name of FuseSource Corp. nor the names of its |
|
||||||
contributors may be used to endorse or promote products derived from |
|
||||||
this software without specific prior written permission. |
|
||||||
|
|
||||||
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. |
|
||||||
--> |
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion> |
|
||||||
<parent> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-project</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</parent> |
|
||||||
|
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-linux64</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
|
|
||||||
<name>${project.artifactId}</name> |
|
||||||
<description>The leveldbjni linux 64 native libraries</description> |
|
||||||
|
|
||||||
<dependencies> |
|
||||||
<dependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</dependency> |
|
||||||
</dependencies> |
|
||||||
|
|
||||||
<build> |
|
||||||
<testSourceDirectory>${basedir}/../leveldbjni/src/test/java</testSourceDirectory> |
|
||||||
|
|
||||||
<plugins> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-jar-plugin</artifactId> |
|
||||||
<version>2.3.1</version> |
|
||||||
<configuration> |
|
||||||
<classesDirectory>${basedir}/target/generated-sources/hawtjni/lib</classesDirectory> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
<plugin> |
|
||||||
<groupId>org.fusesource.hawtjni</groupId> |
|
||||||
<artifactId>maven-hawtjni-plugin</artifactId> |
|
||||||
<version>${hawtjni-version}</version> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<goals> |
|
||||||
<goal>build</goal> |
|
||||||
</goals> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
<configuration> |
|
||||||
<name>leveldbjni</name> |
|
||||||
<classified>false</classified> |
|
||||||
<nativeSrcDependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni</artifactId> |
|
||||||
<version>${project.version}</version> |
|
||||||
<classifier>native-src</classifier> |
|
||||||
<type>zip</type> |
|
||||||
</nativeSrcDependency> |
|
||||||
<configureArgs> |
|
||||||
<arg>--with-leveldb=${env.LEVELDB_HOME}</arg> |
|
||||||
<arg>--with-snappy=${env.SNAPPY_HOME}</arg> |
|
||||||
</configureArgs> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
</plugins> |
|
||||||
</build> |
|
||||||
|
|
||||||
</project> |
|
@ -1,110 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!-- |
|
||||||
Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
|
|
||||||
http://fusesource.com |
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without |
|
||||||
modification, are permitted provided that the following conditions are |
|
||||||
met: |
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright |
|
||||||
notice, this list of conditions and the following disclaimer. |
|
||||||
* 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. |
|
||||||
* Neither the name of FuseSource Corp. nor the names of its |
|
||||||
contributors may be used to endorse or promote products derived from |
|
||||||
this software without specific prior written permission. |
|
||||||
|
|
||||||
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. |
|
||||||
--> |
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion> |
|
||||||
<parent> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-project</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</parent> |
|
||||||
|
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-osx</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
|
|
||||||
<name>${project.artifactId}</name> |
|
||||||
<description>The leveldbjni OS X universal native libraries</description> |
|
||||||
|
|
||||||
<dependencies> |
|
||||||
<dependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</dependency> |
|
||||||
|
|
||||||
<dependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
<type>test-jar</type> |
|
||||||
<scope>test</scope> |
|
||||||
</dependency> |
|
||||||
</dependencies> |
|
||||||
|
|
||||||
<build> |
|
||||||
<testSourceDirectory>${basedir}/../leveldbjni/src/test/java</testSourceDirectory> |
|
||||||
<plugins> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-jar-plugin</artifactId> |
|
||||||
<version>2.3.1</version> |
|
||||||
<configuration> |
|
||||||
<classesDirectory>${basedir}/target/generated-sources/hawtjni/lib</classesDirectory> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.fusesource.hawtjni</groupId> |
|
||||||
<artifactId>maven-hawtjni-plugin</artifactId> |
|
||||||
<version>${hawtjni-version}</version> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<goals> |
|
||||||
<goal>build</goal> |
|
||||||
</goals> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
<configuration> |
|
||||||
<name>leveldbjni</name> |
|
||||||
<classified>false</classified> |
|
||||||
<nativeSrcDependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni</artifactId> |
|
||||||
<version>${project.version}</version> |
|
||||||
<classifier>native-src</classifier> |
|
||||||
<type>zip</type> |
|
||||||
</nativeSrcDependency> |
|
||||||
<platform>osx</platform> |
|
||||||
<configureArgs> |
|
||||||
<arg>--with-leveldb=${env.LEVELDB_HOME}</arg> |
|
||||||
<arg>--with-snappy=${env.SNAPPY_HOME}</arg> |
|
||||||
<arg>--with-universal</arg> |
|
||||||
</configureArgs> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
</plugins> |
|
||||||
</build> |
|
||||||
|
|
||||||
</project> |
|
@ -1,97 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!-- |
|
||||||
Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
|
|
||||||
http://fusesource.com |
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without |
|
||||||
modification, are permitted provided that the following conditions are |
|
||||||
met: |
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright |
|
||||||
notice, this list of conditions and the following disclaimer. |
|
||||||
* 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. |
|
||||||
* Neither the name of FuseSource Corp. nor the names of its |
|
||||||
contributors may be used to endorse or promote products derived from |
|
||||||
this software without specific prior written permission. |
|
||||||
|
|
||||||
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. |
|
||||||
--> |
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion> |
|
||||||
<parent> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-project</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</parent> |
|
||||||
|
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-win32</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
|
|
||||||
<name>${project.artifactId}</name> |
|
||||||
<description>The leveldbjni Windows 32 bit native libraries</description> |
|
||||||
|
|
||||||
<dependencies> |
|
||||||
<dependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</dependency> |
|
||||||
</dependencies> |
|
||||||
|
|
||||||
<build> |
|
||||||
<testSourceDirectory>${basedir}/../leveldbjni/src/test/java</testSourceDirectory> |
|
||||||
|
|
||||||
<plugins> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-jar-plugin</artifactId> |
|
||||||
<version>2.3.1</version> |
|
||||||
<configuration> |
|
||||||
<classesDirectory>${basedir}/target/generated-sources/hawtjni/lib</classesDirectory> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
<plugin> |
|
||||||
<groupId>org.fusesource.hawtjni</groupId> |
|
||||||
<artifactId>maven-hawtjni-plugin</artifactId> |
|
||||||
<version>${hawtjni-version}</version> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<goals> |
|
||||||
<goal>build</goal> |
|
||||||
</goals> |
|
||||||
<phase>compile</phase> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
<configuration> |
|
||||||
<name>leveldbjni</name> |
|
||||||
<classified>false</classified> |
|
||||||
<nativeSrcDependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni</artifactId> |
|
||||||
<version>${project.version}</version> |
|
||||||
<classifier>native-src</classifier> |
|
||||||
<type>zip</type> |
|
||||||
</nativeSrcDependency> |
|
||||||
<packageDirectory>${basedir}/../leveldbjni/target/generated-sources/hawtjni/native-package</packageDirectory> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
</plugins> |
|
||||||
</build> |
|
||||||
|
|
||||||
</project> |
|
@ -1,96 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!-- |
|
||||||
Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
|
|
||||||
http://fusesource.com |
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without |
|
||||||
modification, are permitted provided that the following conditions are |
|
||||||
met: |
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright |
|
||||||
notice, this list of conditions and the following disclaimer. |
|
||||||
* 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. |
|
||||||
* Neither the name of FuseSource Corp. nor the names of its |
|
||||||
contributors may be used to endorse or promote products derived from |
|
||||||
this software without specific prior written permission. |
|
||||||
|
|
||||||
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. |
|
||||||
--> |
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion> |
|
||||||
<parent> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-project</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</parent> |
|
||||||
|
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-win64</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
|
|
||||||
<name>${project.artifactId}</name> |
|
||||||
<description>The leveldbjni Windows 64 bit native libraries</description> |
|
||||||
|
|
||||||
<dependencies> |
|
||||||
<dependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</dependency> |
|
||||||
</dependencies> |
|
||||||
|
|
||||||
<build> |
|
||||||
<testSourceDirectory>${basedir}/../leveldbjni/src/test/java</testSourceDirectory> |
|
||||||
|
|
||||||
<plugins> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-jar-plugin</artifactId> |
|
||||||
<version>2.3.1</version> |
|
||||||
<configuration> |
|
||||||
<classesDirectory>${basedir}/target/generated-sources/hawtjni/lib</classesDirectory> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
<plugin> |
|
||||||
<groupId>org.fusesource.hawtjni</groupId> |
|
||||||
<artifactId>maven-hawtjni-plugin</artifactId> |
|
||||||
<version>${hawtjni-version}</version> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<goals> |
|
||||||
<goal>build</goal> |
|
||||||
</goals> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
<configuration> |
|
||||||
<name>leveldbjni</name> |
|
||||||
<classified>false</classified> |
|
||||||
<nativeSrcDependency> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni</artifactId> |
|
||||||
<version>${project.version}</version> |
|
||||||
<classifier>native-src</classifier> |
|
||||||
<type>zip</type> |
|
||||||
</nativeSrcDependency> |
|
||||||
<packageDirectory>${basedir}/../leveldbjni/target/generated-sources/hawtjni/native-package</packageDirectory> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
</plugins> |
|
||||||
</build> |
|
||||||
|
|
||||||
</project> |
|
@ -1,180 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!-- |
|
||||||
Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
|
|
||||||
http://fusesource.com |
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without |
|
||||||
modification, are permitted provided that the following conditions are |
|
||||||
met: |
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright |
|
||||||
notice, this list of conditions and the following disclaimer. |
|
||||||
* 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. |
|
||||||
* Neither the name of FuseSource Corp. nor the names of its |
|
||||||
contributors may be used to endorse or promote products derived from |
|
||||||
this software without specific prior written permission. |
|
||||||
|
|
||||||
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. |
|
||||||
--> |
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion> |
|
||||||
<parent> |
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-project</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
</parent> |
|
||||||
|
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
<packaging>jar</packaging> |
|
||||||
|
|
||||||
<name>${project.artifactId}</name> |
|
||||||
<description>leveldbjni is a jni library for acessing leveldb.</description> |
|
||||||
|
|
||||||
<properties> |
|
||||||
<skipAutogen>false</skipAutogen> |
|
||||||
</properties> |
|
||||||
|
|
||||||
<dependencies> |
|
||||||
<dependency> |
|
||||||
<groupId>org.fusesource.hawtjni</groupId> |
|
||||||
<artifactId>hawtjni-runtime</artifactId> |
|
||||||
<version>${hawtjni-version}</version> |
|
||||||
</dependency> |
|
||||||
<dependency> |
|
||||||
<groupId>org.iq80.leveldb</groupId> |
|
||||||
<artifactId>leveldb-api</artifactId> |
|
||||||
<version>${leveldb-api-version}</version> |
|
||||||
</dependency> |
|
||||||
</dependencies> |
|
||||||
|
|
||||||
<build> |
|
||||||
<resources> |
|
||||||
<resource> |
|
||||||
<directory>${project.basedir}/src/main/resources</directory> |
|
||||||
<filtering>true</filtering> |
|
||||||
<includes> |
|
||||||
<include>**/*</include> |
|
||||||
</includes> |
|
||||||
</resource> |
|
||||||
</resources> |
|
||||||
<plugins> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-jar-plugin</artifactId> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<goals> |
|
||||||
<goal>test-jar</goal> |
|
||||||
</goals> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.fusesource.hawtjni</groupId> |
|
||||||
<artifactId>maven-hawtjni-plugin</artifactId> |
|
||||||
<version>${hawtjni-version}</version> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<goals> |
|
||||||
<goal>generate</goal> |
|
||||||
<goal>package-source</goal> |
|
||||||
</goals> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
<configuration> |
|
||||||
<skipAutogen>${skipAutogen}</skipAutogen> |
|
||||||
<name>leveldbjni</name> |
|
||||||
<callbacks>false</callbacks> |
|
||||||
<copyright><![CDATA[ |
|
||||||
/******************************************************************************* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com |
|
||||||
* |
|
||||||
* The software in this package is published under the terms of the |
|
||||||
* CDDL license a copy of which has been included with this distribution |
|
||||||
* in the license.txt file. |
|
||||||
*******************************************************************************/ |
|
||||||
]]></copyright> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-surefire-plugin</artifactId> |
|
||||||
<version>2.4.3</version> |
|
||||||
<configuration> |
|
||||||
<redirectTestOutputToFile>true</redirectTestOutputToFile> |
|
||||||
<forkMode>once</forkMode> |
|
||||||
<argLine>-ea</argLine> |
|
||||||
<failIfNoTests>false</failIfNoTests> |
|
||||||
<workingDirectory>${project.build.directory}</workingDirectory> |
|
||||||
<excludes> |
|
||||||
<exclude>**/*</exclude> |
|
||||||
</excludes> |
|
||||||
<includes> |
|
||||||
<include>**/*Test.java</include> |
|
||||||
</includes> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-compiler-plugin</artifactId> |
|
||||||
<configuration> |
|
||||||
<source>1.5</source> |
|
||||||
<target>1.5</target> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.felix</groupId> |
|
||||||
<artifactId>maven-bundle-plugin</artifactId> |
|
||||||
<version>2.0.1</version> |
|
||||||
<executions> |
|
||||||
<execution> |
|
||||||
<id>bundle-manifest</id> |
|
||||||
<phase>process-classes</phase> |
|
||||||
<goals> |
|
||||||
<goal>manifest</goal> |
|
||||||
</goals> |
|
||||||
<configuration> |
|
||||||
<instructions> |
|
||||||
<Import-Package>!org.fusesource.leveldbjni*,!org.fusesource.hawtjni*,sun.reflect;resolution:=optional,*</Import-Package> |
|
||||||
</instructions> |
|
||||||
</configuration> |
|
||||||
</execution> |
|
||||||
</executions> |
|
||||||
</plugin> |
|
||||||
<plugin> |
|
||||||
<artifactId>maven-jar-plugin</artifactId> |
|
||||||
<configuration> |
|
||||||
<archive> |
|
||||||
<manifestFile>${project.build.outputDirectory}/META-INF/MANIFEST.MF</manifestFile> |
|
||||||
</archive> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
</plugins> |
|
||||||
</build> |
|
||||||
|
|
||||||
</project> |
|
@ -1,212 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni; |
|
||||||
|
|
||||||
import org.fusesource.leveldbjni.internal.*; |
|
||||||
import org.iq80.leveldb.*; |
|
||||||
|
|
||||||
import java.io.*; |
|
||||||
import java.net.URL; |
|
||||||
import java.util.concurrent.Callable; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class JniDBFactory implements DBFactory { |
|
||||||
|
|
||||||
public static final JniDBFactory factory = new JniDBFactory(); |
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
} |
|
||||||
|
|
||||||
public static final String VERSION; |
|
||||||
static { |
|
||||||
String v="unknown"; |
|
||||||
InputStream is = JniDBFactory.class.getResourceAsStream("version.txt"); |
|
||||||
try { |
|
||||||
v = new BufferedReader(new InputStreamReader(is, "UTF-8")).readLine(); |
|
||||||
} catch (Throwable e) { |
|
||||||
} finally { |
|
||||||
try { |
|
||||||
is.close(); |
|
||||||
} catch (Throwable e) { |
|
||||||
} |
|
||||||
} |
|
||||||
VERSION = v; |
|
||||||
} |
|
||||||
|
|
||||||
public static byte[] bytes(String value) { |
|
||||||
if( value == null) { |
|
||||||
return null; |
|
||||||
} |
|
||||||
try { |
|
||||||
return value.getBytes("UTF-8"); |
|
||||||
} catch (UnsupportedEncodingException e) { |
|
||||||
throw new RuntimeException(e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static String asString(byte value[]) { |
|
||||||
if( value == null) { |
|
||||||
return null; |
|
||||||
} |
|
||||||
try { |
|
||||||
return new String(value, "UTF-8"); |
|
||||||
} catch (UnsupportedEncodingException e) { |
|
||||||
throw new RuntimeException(e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
static private class OptionsResourceHolder { |
|
||||||
|
|
||||||
NativeCache cache = null; |
|
||||||
NativeComparator comparator=null; |
|
||||||
NativeLogger logger=null; |
|
||||||
NativeOptions options; |
|
||||||
|
|
||||||
public void init(Options value) { |
|
||||||
|
|
||||||
options = new NativeOptions(); |
|
||||||
options.blockRestartInterval(value.blockRestartInterval()); |
|
||||||
options.blockSize(value.blockSize()); |
|
||||||
options.createIfMissing(value.createIfMissing()); |
|
||||||
options.errorIfExists(value.errorIfExists()); |
|
||||||
options.maxOpenFiles(value.maxOpenFiles()); |
|
||||||
options.paranoidChecks(value.paranoidChecks()); |
|
||||||
options.writeBufferSize(value.writeBufferSize()); |
|
||||||
|
|
||||||
switch(value.compressionType()) { |
|
||||||
case NONE: |
|
||||||
options.compression(NativeCompressionType.kNoCompression); |
|
||||||
break; |
|
||||||
case SNAPPY: |
|
||||||
options.compression(NativeCompressionType.kSnappyCompression); |
|
||||||
break; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
if(value.cacheSize()>0 ) { |
|
||||||
cache = new NativeCache(value.cacheSize()); |
|
||||||
options.cache(cache); |
|
||||||
} |
|
||||||
|
|
||||||
final DBComparator userComparator = value.comparator(); |
|
||||||
if(userComparator!=null) { |
|
||||||
comparator = new NativeComparator() { |
|
||||||
@Override |
|
||||||
public int compare(byte[] key1, byte[] key2) { |
|
||||||
return userComparator.compare(key1, key2); |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String name() { |
|
||||||
return userComparator.name(); |
|
||||||
} |
|
||||||
}; |
|
||||||
options.comparator(comparator); |
|
||||||
} |
|
||||||
|
|
||||||
final Logger userLogger = value.logger(); |
|
||||||
if(userLogger!=null) { |
|
||||||
logger = new NativeLogger() { |
|
||||||
@Override |
|
||||||
public void log(String message) { |
|
||||||
userLogger.log(message); |
|
||||||
} |
|
||||||
}; |
|
||||||
options.infoLog(logger); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
public void close() { |
|
||||||
if(cache!=null) { |
|
||||||
cache.delete(); |
|
||||||
} |
|
||||||
if(comparator!=null){ |
|
||||||
comparator.delete(); |
|
||||||
} |
|
||||||
if(logger!=null) { |
|
||||||
logger.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public DB open(File path, Options options) throws IOException { |
|
||||||
NativeDB db=null; |
|
||||||
OptionsResourceHolder holder = new OptionsResourceHolder(); |
|
||||||
try { |
|
||||||
holder.init(options); |
|
||||||
db = NativeDB.open(holder.options, path); |
|
||||||
} finally { |
|
||||||
// if we could not open up the DB, then clean up the
|
|
||||||
// other allocated native resouces..
|
|
||||||
if(db==null) { |
|
||||||
holder.close(); |
|
||||||
} |
|
||||||
} |
|
||||||
return new JniDB(db, holder.cache, holder.comparator, holder.logger); |
|
||||||
} |
|
||||||
|
|
||||||
public void destroy(File path, Options options) throws IOException { |
|
||||||
OptionsResourceHolder holder = new OptionsResourceHolder(); |
|
||||||
try { |
|
||||||
holder.init(options); |
|
||||||
NativeDB.destroy(path, holder.options); |
|
||||||
} finally { |
|
||||||
holder.close(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public void repair(File path, Options options) throws IOException { |
|
||||||
OptionsResourceHolder holder = new OptionsResourceHolder(); |
|
||||||
try { |
|
||||||
holder.init(options); |
|
||||||
NativeDB.repair(path, holder.options); |
|
||||||
} finally { |
|
||||||
holder.close(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
@Override |
|
||||||
public String toString() { |
|
||||||
return String.format("leveldbjni version %s", VERSION); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public static void pushMemoryPool(int size) { |
|
||||||
NativeBuffer.pushMemoryPool(size); |
|
||||||
} |
|
||||||
|
|
||||||
public static void popMemoryPool() { |
|
||||||
NativeBuffer.popMemoryPool(); |
|
||||||
} |
|
||||||
} |
|
@ -1,235 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.iq80.leveldb.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class JniDB implements DB { |
|
||||||
|
|
||||||
private final NativeDB db; |
|
||||||
private final NativeCache cache; |
|
||||||
private final NativeComparator comparator; |
|
||||||
private final NativeLogger logger; |
|
||||||
|
|
||||||
public JniDB(NativeDB db, NativeCache cache, NativeComparator comparator, NativeLogger logger) { |
|
||||||
this.db = db; |
|
||||||
this.cache = cache; |
|
||||||
this.comparator = comparator; |
|
||||||
this.logger = logger; |
|
||||||
} |
|
||||||
|
|
||||||
public void close() { |
|
||||||
db.delete(); |
|
||||||
if(cache!=null) { |
|
||||||
cache.delete(); |
|
||||||
} |
|
||||||
if(comparator!=null){ |
|
||||||
comparator.delete(); |
|
||||||
} |
|
||||||
if(logger!=null) { |
|
||||||
logger.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public byte[] get(byte[] key) throws DBException { |
|
||||||
return get(key, new ReadOptions()); |
|
||||||
} |
|
||||||
|
|
||||||
public byte[] get(byte[] key, ReadOptions options) throws DBException { |
|
||||||
try { |
|
||||||
return db.get(convert(options), key); |
|
||||||
} catch (NativeDB.DBException e) { |
|
||||||
if(e.isNotFound()) { |
|
||||||
return null; |
|
||||||
} |
|
||||||
throw new DBException(e.getMessage(), e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public DBIterator iterator() { |
|
||||||
return iterator(new ReadOptions()); |
|
||||||
} |
|
||||||
|
|
||||||
public DBIterator iterator(ReadOptions options) { |
|
||||||
return new JniDBIterator(db.iterator(convert(options))); |
|
||||||
} |
|
||||||
|
|
||||||
public void put(byte[] key, byte[] value) throws DBException { |
|
||||||
put(key, value, new WriteOptions()); |
|
||||||
} |
|
||||||
|
|
||||||
public void delete(byte[] key) throws DBException { |
|
||||||
delete(key, new WriteOptions()); |
|
||||||
} |
|
||||||
|
|
||||||
public void write(WriteBatch updates) throws DBException { |
|
||||||
write(updates, new WriteOptions()); |
|
||||||
} |
|
||||||
|
|
||||||
public WriteBatch createWriteBatch() { |
|
||||||
return new JniWriteBatch(new NativeWriteBatch()); |
|
||||||
} |
|
||||||
|
|
||||||
public Snapshot put(byte[] key, byte[] value, WriteOptions options) throws DBException { |
|
||||||
try { |
|
||||||
db.put(convert(options), key, value); |
|
||||||
return null; |
|
||||||
} catch (NativeDB.DBException e) { |
|
||||||
throw new DBException(e.getMessage(), e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public Snapshot delete(byte[] key, WriteOptions options) throws DBException { |
|
||||||
try { |
|
||||||
db.delete(convert(options), key); |
|
||||||
return null; |
|
||||||
} catch (NativeDB.DBException e) { |
|
||||||
throw new DBException(e.getMessage(), e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public Snapshot write(WriteBatch updates, WriteOptions options) throws DBException { |
|
||||||
try { |
|
||||||
db.write(convert(options), ((JniWriteBatch) updates).writeBatch()); |
|
||||||
return null; |
|
||||||
} catch (NativeDB.DBException e) { |
|
||||||
throw new DBException(e.getMessage(), e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public Snapshot getSnapshot() { |
|
||||||
return new JniSnapshot(db, db.getSnapshot()); |
|
||||||
} |
|
||||||
|
|
||||||
public long[] getApproximateSizes(Range... ranges) { |
|
||||||
NativeRange args[] = new NativeRange[ranges.length]; |
|
||||||
for (int i = 0; i < args.length; i++) { |
|
||||||
args[i] = new NativeRange(ranges[i].start(), ranges[i].limit()); |
|
||||||
} |
|
||||||
return db.getApproximateSizes(args); |
|
||||||
} |
|
||||||
|
|
||||||
public String getProperty(String name) { |
|
||||||
return db.getProperty(name); |
|
||||||
} |
|
||||||
|
|
||||||
private NativeReadOptions convert(ReadOptions options) { |
|
||||||
if(options==null) { |
|
||||||
return null; |
|
||||||
} |
|
||||||
NativeReadOptions rc = new NativeReadOptions(); |
|
||||||
rc.fillCache(options.fillCache()); |
|
||||||
rc.verifyChecksums(options.verifyChecksums()); |
|
||||||
if(options.snapshot()!=null) { |
|
||||||
rc.snapshot(((JniSnapshot) options.snapshot()).snapshot()); |
|
||||||
} |
|
||||||
return rc; |
|
||||||
} |
|
||||||
|
|
||||||
private NativeWriteOptions convert(WriteOptions options) { |
|
||||||
if(options==null) { |
|
||||||
return null; |
|
||||||
} |
|
||||||
NativeWriteOptions rc = new NativeWriteOptions(); |
|
||||||
rc.sync(options.sync()); |
|
||||||
if(options.snapshot()) { |
|
||||||
throw new UnsupportedOperationException("WriteOptions snapshot not supported"); |
|
||||||
} |
|
||||||
return rc; |
|
||||||
} |
|
||||||
|
|
||||||
public void compactRange(byte[] begin, byte[] end) throws DBException { |
|
||||||
db.compactRange(begin, end); |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Using a fork of leveldb with db Suspend / Resume methods to avoid
|
|
||||||
// having to callback into java.
|
|
||||||
//
|
|
||||||
public void suspendCompactions() throws InterruptedException { |
|
||||||
db.suspendCompactions(); |
|
||||||
} |
|
||||||
public void resumeCompactions() { |
|
||||||
db.resumeCompactions(); |
|
||||||
} |
|
||||||
|
|
||||||
// private static class Suspension {
|
|
||||||
// static long env = Util.EnvJNI.Default();
|
|
||||||
//
|
|
||||||
// CountDownLatch suspended = new CountDownLatch(1);
|
|
||||||
// CountDownLatch resumed = new CountDownLatch(1);
|
|
||||||
// Callback callback = new Callback(this, "suspended", 1);
|
|
||||||
//
|
|
||||||
// public Suspension() {
|
|
||||||
// Util.EnvJNI.Schedule(env, callback.getAddress(), 0);
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// private long suspended(long arg) {
|
|
||||||
// suspended.countDown();
|
|
||||||
// try {
|
|
||||||
// resumed.await();
|
|
||||||
// } catch (InterruptedException e) {
|
|
||||||
// } finally {
|
|
||||||
// callback.dispose();
|
|
||||||
// }
|
|
||||||
// return 0;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// int suspendCounter = 0;
|
|
||||||
// Suspension suspension = null;
|
|
||||||
//
|
|
||||||
// public void suspendCompactions() throws InterruptedException {
|
|
||||||
// Suspension s = null;
|
|
||||||
// synchronized (this) {
|
|
||||||
// suspendCounter++;
|
|
||||||
// if( suspendCounter==1 ) {
|
|
||||||
// suspension = new Suspension();
|
|
||||||
// }
|
|
||||||
// s = suspension;
|
|
||||||
// }
|
|
||||||
// // Don't return until the compactions have suspended.
|
|
||||||
// s.suspended.await();
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
// synchronized public void resumeCompactions() {
|
|
||||||
// suspendCounter--;
|
|
||||||
// if( suspendCounter==0 ) {
|
|
||||||
// suspension.resumed.countDown();
|
|
||||||
// suspension = null;
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
} |
|
@ -1,146 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.leveldbjni.internal.NativeDB; |
|
||||||
import org.fusesource.leveldbjni.internal.NativeIterator; |
|
||||||
import org.iq80.leveldb.DBIterator; |
|
||||||
|
|
||||||
import java.util.AbstractMap; |
|
||||||
import java.util.Map; |
|
||||||
import java.util.NoSuchElementException; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class JniDBIterator implements DBIterator { |
|
||||||
|
|
||||||
private final NativeIterator iterator; |
|
||||||
|
|
||||||
JniDBIterator(NativeIterator iterator) { |
|
||||||
this.iterator = iterator; |
|
||||||
} |
|
||||||
|
|
||||||
public void close() { |
|
||||||
iterator.delete(); |
|
||||||
} |
|
||||||
|
|
||||||
public void remove() { |
|
||||||
throw new UnsupportedOperationException(); |
|
||||||
} |
|
||||||
|
|
||||||
public void seek(byte[] key) { |
|
||||||
try { |
|
||||||
iterator.seek(key); |
|
||||||
} catch (NativeDB.DBException e) { |
|
||||||
if( e.isNotFound() ) { |
|
||||||
throw new NoSuchElementException(); |
|
||||||
} else { |
|
||||||
throw new RuntimeException(e); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public void seekToFirst() { |
|
||||||
iterator.seekToFirst(); |
|
||||||
} |
|
||||||
|
|
||||||
public void seekToLast() { |
|
||||||
iterator.seekToLast(); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public Map.Entry<byte[], byte[]> peekNext() { |
|
||||||
if(!iterator.isValid()) { |
|
||||||
throw new NoSuchElementException(); |
|
||||||
} |
|
||||||
try { |
|
||||||
return new AbstractMap.SimpleImmutableEntry<byte[],byte[]>(iterator.key(), iterator.value()); |
|
||||||
} catch (NativeDB.DBException e) { |
|
||||||
throw new RuntimeException(e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public boolean hasNext() { |
|
||||||
return iterator.isValid(); |
|
||||||
} |
|
||||||
|
|
||||||
public Map.Entry<byte[], byte[]> next() { |
|
||||||
Map.Entry<byte[], byte[]> rc = peekNext(); |
|
||||||
try { |
|
||||||
iterator.next(); |
|
||||||
} catch (NativeDB.DBException e) { |
|
||||||
throw new RuntimeException(e); |
|
||||||
} |
|
||||||
return rc; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean hasPrev() { |
|
||||||
if( !iterator.isValid() ) |
|
||||||
return false; |
|
||||||
try { |
|
||||||
iterator.prev(); |
|
||||||
try { |
|
||||||
return iterator.isValid(); |
|
||||||
} finally { |
|
||||||
iterator.next(); |
|
||||||
} |
|
||||||
} catch (NativeDB.DBException e) { |
|
||||||
throw new RuntimeException(e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public Map.Entry<byte[], byte[]> peekPrev() { |
|
||||||
try { |
|
||||||
iterator.prev(); |
|
||||||
try { |
|
||||||
return peekNext(); |
|
||||||
} finally { |
|
||||||
iterator.next(); |
|
||||||
} |
|
||||||
} catch (NativeDB.DBException e) { |
|
||||||
throw new RuntimeException(e); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public Map.Entry<byte[], byte[]> prev() { |
|
||||||
Map.Entry<byte[], byte[]> rc = peekPrev(); |
|
||||||
try { |
|
||||||
iterator.prev(); |
|
||||||
} catch (NativeDB.DBException e) { |
|
||||||
throw new RuntimeException(e); |
|
||||||
} |
|
||||||
return rc; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,57 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.leveldbjni.internal.*; |
|
||||||
import org.iq80.leveldb.Snapshot; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class JniSnapshot implements Snapshot { |
|
||||||
|
|
||||||
private final NativeDB db; |
|
||||||
private final NativeSnapshot snapshot; |
|
||||||
|
|
||||||
JniSnapshot(NativeDB db, NativeSnapshot snapshot) { |
|
||||||
this.db = db; |
|
||||||
this.snapshot = snapshot; |
|
||||||
} |
|
||||||
|
|
||||||
public void close() { |
|
||||||
db.releaseSnapshot(snapshot); |
|
||||||
} |
|
||||||
|
|
||||||
NativeSnapshot snapshot() { |
|
||||||
return snapshot; |
|
||||||
} |
|
||||||
} |
|
@ -1,65 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.leveldbjni.internal.NativeWriteBatch; |
|
||||||
import org.iq80.leveldb.WriteBatch; |
|
||||||
|
|
||||||
/** |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class JniWriteBatch implements WriteBatch { |
|
||||||
|
|
||||||
private final NativeWriteBatch writeBatch; |
|
||||||
|
|
||||||
JniWriteBatch(NativeWriteBatch writeBatch) { |
|
||||||
this.writeBatch = writeBatch; |
|
||||||
} |
|
||||||
|
|
||||||
public void close() { |
|
||||||
writeBatch.delete(); |
|
||||||
} |
|
||||||
|
|
||||||
public WriteBatch put(byte[] key, byte[] value) { |
|
||||||
writeBatch.put(key, value); |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public WriteBatch delete(byte[] key) { |
|
||||||
writeBatch.delete(key); |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeWriteBatch writeBatch() { |
|
||||||
return writeBatch; |
|
||||||
} |
|
||||||
} |
|
@ -1,285 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.JniArg; |
|
||||||
import org.fusesource.hawtjni.runtime.JniClass; |
|
||||||
import org.fusesource.hawtjni.runtime.JniMethod; |
|
||||||
import org.fusesource.hawtjni.runtime.PointerMath; |
|
||||||
|
|
||||||
import java.util.concurrent.Callable; |
|
||||||
import java.util.concurrent.atomic.AtomicInteger; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.ArgFlag.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* A NativeBuffer allocates a native buffer on the heap. It supports |
|
||||||
* creating sub slices/views of that buffer and manages reference tracking |
|
||||||
* so that the the native buffer is freed once all NativeBuffer views |
|
||||||
* are deleted. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class NativeBuffer extends NativeObject { |
|
||||||
|
|
||||||
@JniClass |
|
||||||
static class NativeBufferJNI { |
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
} |
|
||||||
|
|
||||||
@JniMethod(cast="void *") |
|
||||||
public static final native long malloc( |
|
||||||
@JniArg(cast="size_t") long size); |
|
||||||
|
|
||||||
public static final native void free( |
|
||||||
@JniArg(cast="void *") long self); |
|
||||||
|
|
||||||
// public static final native void buffer_copy (
|
|
||||||
// @JniArg(cast="const void *") long src,
|
|
||||||
// @JniArg(cast="size_t") long srcPos,
|
|
||||||
// @JniArg(cast="void *") long dest,
|
|
||||||
// @JniArg(cast="size_t") long destPos,
|
|
||||||
// @JniArg(cast="size_t") long length);
|
|
||||||
|
|
||||||
public static final native void buffer_copy ( |
|
||||||
@JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) byte[] src, |
|
||||||
@JniArg(cast="size_t") long srcPos, |
|
||||||
@JniArg(cast="void *") long dest, |
|
||||||
@JniArg(cast="size_t") long destPos, |
|
||||||
@JniArg(cast="size_t") long length); |
|
||||||
|
|
||||||
public static final native void buffer_copy ( |
|
||||||
@JniArg(cast="const void *") long src, |
|
||||||
@JniArg(cast="size_t") long srcPos, |
|
||||||
@JniArg(cast="void *", flags={NO_IN, CRITICAL}) byte[] dest, |
|
||||||
@JniArg(cast="size_t") long destPos, |
|
||||||
@JniArg(cast="size_t") long length); |
|
||||||
|
|
||||||
// @JniMethod(cast="void *")
|
|
||||||
// public static final native long memset (
|
|
||||||
// @JniArg(cast="void *") long buffer,
|
|
||||||
// int c,
|
|
||||||
// @JniArg(cast="size_t") long num);
|
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
private static class Allocation extends NativeObject { |
|
||||||
private final AtomicInteger retained = new AtomicInteger(0); |
|
||||||
|
|
||||||
private Allocation(long size) { |
|
||||||
super(NativeBufferJNI.malloc(size)); |
|
||||||
} |
|
||||||
|
|
||||||
void retain() { |
|
||||||
assertAllocated(); |
|
||||||
retained.incrementAndGet(); |
|
||||||
} |
|
||||||
|
|
||||||
void release() { |
|
||||||
assertAllocated(); |
|
||||||
int r = retained.decrementAndGet(); |
|
||||||
if( r < 0 ) { |
|
||||||
throw new Error("The object has already been deleted."); |
|
||||||
} else if( r==0 ) { |
|
||||||
NativeBufferJNI.free(self); |
|
||||||
} |
|
||||||
self = 0; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private static class Pool { |
|
||||||
private final NativeBuffer.Pool prev; |
|
||||||
Allocation allocation; |
|
||||||
long pos; |
|
||||||
long remaining; |
|
||||||
int chunk; |
|
||||||
|
|
||||||
public Pool(int chunk, Pool prev) { |
|
||||||
this.chunk = chunk; |
|
||||||
this.prev = prev; |
|
||||||
} |
|
||||||
|
|
||||||
NativeBuffer create(long size) { |
|
||||||
if( size >= chunk ) { |
|
||||||
Allocation allocation = new Allocation(size); |
|
||||||
return new NativeBuffer(allocation, allocation.self, size); |
|
||||||
} |
|
||||||
|
|
||||||
if( remaining < size ) { |
|
||||||
delete(); |
|
||||||
} |
|
||||||
|
|
||||||
if( allocation == null ) { |
|
||||||
allocate(); |
|
||||||
} |
|
||||||
|
|
||||||
NativeBuffer rc = new NativeBuffer(allocation, pos, size); |
|
||||||
pos = PointerMath.add(pos, size); |
|
||||||
remaining -= size; |
|
||||||
return rc; |
|
||||||
} |
|
||||||
|
|
||||||
private void allocate() { |
|
||||||
allocation = new NativeBuffer.Allocation(chunk); |
|
||||||
allocation.retain(); |
|
||||||
remaining = chunk; |
|
||||||
pos = allocation.self; |
|
||||||
} |
|
||||||
|
|
||||||
public void delete() { |
|
||||||
if( allocation!=null ) { |
|
||||||
allocation.release(); |
|
||||||
allocation = null; |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private final Allocation allocation; |
|
||||||
private final long capacity; |
|
||||||
|
|
||||||
static final private ThreadLocal<Pool> CURRENT_POOL = new ThreadLocal<Pool>(); |
|
||||||
|
|
||||||
static public NativeBuffer create(long capacity) { |
|
||||||
Pool pool = CURRENT_POOL.get(); |
|
||||||
if( pool == null ) { |
|
||||||
Allocation allocation = new Allocation(capacity); |
|
||||||
return new NativeBuffer(allocation, allocation.self, capacity); |
|
||||||
} else { |
|
||||||
return pool.create(capacity); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public static void pushMemoryPool(int size) { |
|
||||||
Pool original = CURRENT_POOL.get(); |
|
||||||
Pool next = new Pool(size, original); |
|
||||||
CURRENT_POOL.set(next); |
|
||||||
} |
|
||||||
|
|
||||||
public static void popMemoryPool() { |
|
||||||
Pool next = CURRENT_POOL.get(); |
|
||||||
next.delete(); |
|
||||||
if( next.prev == null ) { |
|
||||||
CURRENT_POOL.remove(); |
|
||||||
} else { |
|
||||||
CURRENT_POOL.set(next.prev); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
static public NativeBuffer create(byte[] data) { |
|
||||||
if( data == null ) { |
|
||||||
return null; |
|
||||||
} else { |
|
||||||
return create(data, 0 , data.length); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
static public NativeBuffer create(String data) { |
|
||||||
return create(cbytes(data)); |
|
||||||
} |
|
||||||
|
|
||||||
static public NativeBuffer create(byte[] data, int offset, int length) { |
|
||||||
NativeBuffer rc = create(length); |
|
||||||
rc.write(0, data, offset, length); |
|
||||||
return rc; |
|
||||||
} |
|
||||||
|
|
||||||
private NativeBuffer(Allocation allocation, long self, long capacity) { |
|
||||||
super(self); |
|
||||||
this.capacity = capacity; |
|
||||||
this.allocation = allocation; |
|
||||||
this.allocation.retain(); |
|
||||||
} |
|
||||||
|
|
||||||
public NativeBuffer slice(long offset, long length) { |
|
||||||
assertAllocated(); |
|
||||||
if( length < 0 ) throw new IllegalArgumentException("length cannot be negative"); |
|
||||||
if( offset < 0 ) throw new IllegalArgumentException("offset cannot be negative"); |
|
||||||
if( offset+length >= capacity) throw new ArrayIndexOutOfBoundsException("offset + length exceed the length of this buffer"); |
|
||||||
return new NativeBuffer(allocation, PointerMath.add(self, offset), length); |
|
||||||
} |
|
||||||
|
|
||||||
static byte[] cbytes(String strvalue) { |
|
||||||
byte[] value = strvalue.getBytes(); |
|
||||||
// expand by 1 so we get a null at the end.
|
|
||||||
byte[] rc = new byte[value.length+1]; |
|
||||||
System.arraycopy(value, 0, rc, 0, value.length); |
|
||||||
return rc; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeBuffer head(long length) { |
|
||||||
return slice(0, length); |
|
||||||
} |
|
||||||
|
|
||||||
public NativeBuffer tail(long length) { |
|
||||||
if( capacity-length < 0) throw new ArrayIndexOutOfBoundsException("capacity-length cannot be less than zero"); |
|
||||||
return slice(capacity-length, length); |
|
||||||
} |
|
||||||
|
|
||||||
public void delete() { |
|
||||||
allocation.release(); |
|
||||||
} |
|
||||||
|
|
||||||
public long capacity() { |
|
||||||
return capacity; |
|
||||||
} |
|
||||||
|
|
||||||
public void write(long at, byte []source, int offset, int length) { |
|
||||||
assertAllocated(); |
|
||||||
if( length < 0 ) throw new IllegalArgumentException("length cannot be negative"); |
|
||||||
if( offset < 0 ) throw new IllegalArgumentException("offset cannot be negative"); |
|
||||||
if( at < 0 ) throw new IllegalArgumentException("at cannot be negative"); |
|
||||||
if( at+length > capacity ) throw new ArrayIndexOutOfBoundsException("at + length exceeds the capacity of this object"); |
|
||||||
if( offset+length > source.length) throw new ArrayIndexOutOfBoundsException("offset + length exceed the length of the source buffer"); |
|
||||||
NativeBufferJNI.buffer_copy(source, offset, self, at, length); |
|
||||||
} |
|
||||||
|
|
||||||
public void read(long at, byte []target, int offset, int length) { |
|
||||||
assertAllocated(); |
|
||||||
if( length < 0 ) throw new IllegalArgumentException("length cannot be negative"); |
|
||||||
if( offset < 0 ) throw new IllegalArgumentException("offset cannot be negative"); |
|
||||||
if( at < 0 ) throw new IllegalArgumentException("at cannot be negative"); |
|
||||||
if( at+length > capacity ) throw new ArrayIndexOutOfBoundsException("at + length exceeds the capacity of this object"); |
|
||||||
if( offset+length > target.length) throw new ArrayIndexOutOfBoundsException("offset + length exceed the length of the target buffer"); |
|
||||||
NativeBufferJNI.buffer_copy(self, at, target, offset, length); |
|
||||||
} |
|
||||||
|
|
||||||
public byte[] toByteArray() { |
|
||||||
if( capacity > Integer.MAX_VALUE ) { |
|
||||||
throw new OutOfMemoryError("Native buffer larger than the largest allowed Java byte[]"); |
|
||||||
} |
|
||||||
byte [] rc = new byte[(int) capacity]; |
|
||||||
read(0, rc, 0, rc.length); |
|
||||||
return rc; |
|
||||||
} |
|
||||||
} |
|
@ -1,72 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.JniArg; |
|
||||||
import org.fusesource.hawtjni.runtime.JniClass; |
|
||||||
import org.fusesource.hawtjni.runtime.JniMethod; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; |
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.CPP_DELETE; |
|
||||||
|
|
||||||
/** |
|
||||||
* Provides a java interface to the C++ rocksdb::Cache class. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class NativeCache extends NativeObject { |
|
||||||
|
|
||||||
@JniClass(name="rocksdb::Cache", flags={CPP}) |
|
||||||
private static class CacheJNI { |
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
} |
|
||||||
|
|
||||||
@JniMethod(cast="rocksdb::Cache *", accessor="rocksdb::NewLRUCache") |
|
||||||
public static final native long NewLRUCache( |
|
||||||
@JniArg(cast="size_t") long capacity); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_DELETE}) |
|
||||||
public static final native void delete(long self); |
|
||||||
} |
|
||||||
|
|
||||||
public NativeCache(long capacity) { |
|
||||||
super(CacheJNI.NewLRUCache(capacity)); |
|
||||||
} |
|
||||||
|
|
||||||
public void delete() { |
|
||||||
assertAllocated(); |
|
||||||
CacheJNI.delete(self); |
|
||||||
self = 0; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,160 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.*; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.FieldFlag.*; |
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.*; |
|
||||||
import static org.fusesource.hawtjni.runtime.ArgFlag.*; |
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* Provides a java interface to the C++ rocksdb::Comparator class. |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public abstract class NativeComparator extends NativeObject { |
|
||||||
|
|
||||||
@JniClass(name="JNIComparator", flags={STRUCT, CPP}) |
|
||||||
static public class ComparatorJNI { |
|
||||||
|
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
init(); |
|
||||||
} |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_NEW}) |
|
||||||
public static final native long create(); |
|
||||||
@JniMethod(flags={CPP_DELETE}) |
|
||||||
public static final native void delete(long ptr); |
|
||||||
|
|
||||||
public static final native void memmove ( |
|
||||||
@JniArg(cast="void *") long dest, |
|
||||||
@JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) ComparatorJNI src, |
|
||||||
@JniArg(cast="size_t") long size); |
|
||||||
|
|
||||||
public static final native void memmove ( |
|
||||||
@JniArg(cast="void *", flags={NO_IN, CRITICAL}) ComparatorJNI dest, |
|
||||||
@JniArg(cast="const void *") long src, |
|
||||||
@JniArg(cast="size_t") long size); |
|
||||||
|
|
||||||
@JniField(cast="jobject", flags={POINTER_FIELD}) |
|
||||||
long target; |
|
||||||
|
|
||||||
@JniField(cast="jmethodID", flags={POINTER_FIELD}) |
|
||||||
long compare_method; |
|
||||||
|
|
||||||
@JniField(cast="const char *") |
|
||||||
long name; |
|
||||||
|
|
||||||
@JniMethod(flags={CONSTANT_INITIALIZER}) |
|
||||||
private static final native void init(); |
|
||||||
|
|
||||||
@JniField(flags={CONSTANT}, accessor="sizeof(struct JNIComparator)") |
|
||||||
static int SIZEOF; |
|
||||||
|
|
||||||
@JniField(flags={CONSTANT}, cast="const Comparator*", accessor="rocksdb::BytewiseComparator()") |
|
||||||
private static long BYTEWISE_COMPARATOR; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
private NativeBuffer name_buffer; |
|
||||||
private long globalRef; |
|
||||||
|
|
||||||
public NativeComparator() { |
|
||||||
super(ComparatorJNI.create()); |
|
||||||
try { |
|
||||||
name_buffer = NativeBuffer.create(name()); |
|
||||||
globalRef = NativeDB.DBJNI.NewGlobalRef(this); |
|
||||||
if( globalRef==0 ) { |
|
||||||
throw new RuntimeException("jni call failed: NewGlobalRef"); |
|
||||||
} |
|
||||||
ComparatorJNI struct = new ComparatorJNI(); |
|
||||||
struct.compare_method = NativeDB.DBJNI.GetMethodID(this.getClass(), "compare", "(JJ)I"); |
|
||||||
if( struct.compare_method==0 ) { |
|
||||||
throw new RuntimeException("jni call failed: GetMethodID"); |
|
||||||
} |
|
||||||
struct.target = globalRef; |
|
||||||
struct.name = name_buffer.pointer(); |
|
||||||
ComparatorJNI.memmove(self, struct, ComparatorJNI.SIZEOF); |
|
||||||
|
|
||||||
} catch (RuntimeException e) { |
|
||||||
delete(); |
|
||||||
throw e; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static final NativeComparator BYTEWISE_COMPARATOR = new NativeComparator(ComparatorJNI.BYTEWISE_COMPARATOR) { |
|
||||||
@Override |
|
||||||
public void delete() { |
|
||||||
// we won't really delete this one since it's static.
|
|
||||||
} |
|
||||||
@Override |
|
||||||
public int compare(byte[] key1, byte[] key2) { |
|
||||||
throw new UnsupportedOperationException(); |
|
||||||
} |
|
||||||
@Override |
|
||||||
public String name() { |
|
||||||
throw new UnsupportedOperationException(); |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
NativeComparator(long ptr) { |
|
||||||
super(ptr); |
|
||||||
} |
|
||||||
|
|
||||||
public void delete() { |
|
||||||
if( name_buffer!=null ) { |
|
||||||
name_buffer.delete(); |
|
||||||
name_buffer = null; |
|
||||||
} |
|
||||||
if( globalRef!=0 ) { |
|
||||||
NativeDB.DBJNI.DeleteGlobalRef(globalRef); |
|
||||||
globalRef = 0; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private int compare(long ptr1, long ptr2) { |
|
||||||
NativeSlice s1 = new NativeSlice(); |
|
||||||
s1.read(ptr1, 0); |
|
||||||
NativeSlice s2 = new NativeSlice(); |
|
||||||
s2.read(ptr2, 0); |
|
||||||
return compare(s1.toByteArray(), s2.toByteArray()); |
|
||||||
} |
|
||||||
|
|
||||||
public abstract int compare(byte[] key1, byte[] key2); |
|
||||||
public abstract String name(); |
|
||||||
|
|
||||||
} |
|
@ -1,48 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
/** |
|
||||||
* Provides a java interface to the C++ rocksdb::CompressionType enum. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public enum NativeCompressionType { |
|
||||||
kNoCompression(0x0), kSnappyCompression(0x1); |
|
||||||
|
|
||||||
static final int t = kNoCompression.value; |
|
||||||
final int value; |
|
||||||
|
|
||||||
NativeCompressionType(int value) { |
|
||||||
this.value = value; |
|
||||||
} |
|
||||||
} |
|
@ -1,427 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.JniArg; |
|
||||||
import org.fusesource.hawtjni.runtime.JniClass; |
|
||||||
import org.fusesource.hawtjni.runtime.JniMethod; |
|
||||||
import org.fusesource.hawtjni.runtime.Library; |
|
||||||
|
|
||||||
import java.io.File; |
|
||||||
import java.io.IOException; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.ArgFlag.*; |
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; |
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* The DB object provides the main interface to acessing LevelDB |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class NativeDB extends NativeObject { |
|
||||||
|
|
||||||
public static final Library LIBRARY = new Library("leveldbjni", NativeDB.class); |
|
||||||
|
|
||||||
@JniClass(name="rocksdb::DB", flags={CPP}) |
|
||||||
static class DBJNI { |
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
} |
|
||||||
|
|
||||||
@JniMethod(flags={JNI, POINTER_RETURN}, cast="jobject") |
|
||||||
public static final native long NewGlobalRef( |
|
||||||
Object target); |
|
||||||
|
|
||||||
@JniMethod(flags={JNI}, cast="jobject") |
|
||||||
public static final native void DeleteGlobalRef( |
|
||||||
@JniArg(cast="jobject", flags={POINTER_ARG}) |
|
||||||
long target); |
|
||||||
|
|
||||||
@JniMethod(flags={JNI, POINTER_RETURN}, cast="jmethodID") |
|
||||||
public static final native long GetMethodID( |
|
||||||
@JniArg(cast="jclass", flags={POINTER_ARG}) |
|
||||||
Class clazz, |
|
||||||
String name, |
|
||||||
String signature); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_DELETE}) |
|
||||||
static final native void delete( |
|
||||||
long self |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(copy="rocksdb::Status", accessor = "rocksdb::DB::Open") |
|
||||||
static final native long Open( |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeOptions options, |
|
||||||
@JniArg(cast="const char*") String path, |
|
||||||
@JniArg(cast="rocksdb::DB**") long[] self); |
|
||||||
|
|
||||||
@JniMethod(copy="rocksdb::Status", flags={CPP_METHOD}) |
|
||||||
static final native long Put( |
|
||||||
long self, |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeWriteOptions options, |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeSlice key, |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeSlice value |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(copy="rocksdb::Status", flags={CPP_METHOD}) |
|
||||||
static final native long Delete( |
|
||||||
long self, |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeWriteOptions options, |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeSlice key |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(copy="rocksdb::Status", flags={CPP_METHOD}) |
|
||||||
static final native long Write( |
|
||||||
long self, |
|
||||||
@JniArg(flags={BY_VALUE}) NativeWriteOptions options, |
|
||||||
@JniArg(cast="rocksdb::WriteBatch *") long updates |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(copy="rocksdb::Status", flags={CPP_METHOD}) |
|
||||||
static final native long Get( |
|
||||||
long self, |
|
||||||
@JniArg(flags={NO_OUT, BY_VALUE}) NativeReadOptions options, |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeSlice key, |
|
||||||
@JniArg(cast="std::string *") long value |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(cast="rocksdb::Iterator *", flags={CPP_METHOD}) |
|
||||||
static final native long NewIterator( |
|
||||||
long self, |
|
||||||
@JniArg(flags={NO_OUT, BY_VALUE}) NativeReadOptions options |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(cast="rocksdb::Snapshot *", flags={CPP_METHOD}) |
|
||||||
static final native long GetSnapshot( |
|
||||||
long self); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native void ReleaseSnapshot( |
|
||||||
long self, |
|
||||||
@JniArg(cast="const rocksdb::Snapshot *") long snapshot |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native void GetApproximateSizes( |
|
||||||
long self, |
|
||||||
@JniArg(cast="const rocksdb::Range *") long range, |
|
||||||
int n, |
|
||||||
@JniArg(cast="uint64_t*") long[] sizes |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native boolean GetProperty( |
|
||||||
long self, |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeSlice property, |
|
||||||
@JniArg(cast="std::string *") long value |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(copy="rocksdb::Status", accessor = "rocksdb::DestroyDB") |
|
||||||
static final native long DestroyDB( |
|
||||||
@JniArg(cast="const char*") String path, |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeOptions options); |
|
||||||
|
|
||||||
@JniMethod(copy="rocksdb::Status", accessor = "rocksdb::RepairDB") |
|
||||||
static final native long RepairDB( |
|
||||||
@JniArg(cast="const char*") String path, |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeOptions options); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native void CompactRange( |
|
||||||
long self, |
|
||||||
@JniArg(flags={NO_OUT}) NativeSlice begin, |
|
||||||
@JniArg(flags={NO_OUT}) NativeSlice end |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native void SuspendCompactions(long self); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native void ResumeCompactions(long self); |
|
||||||
} |
|
||||||
|
|
||||||
public void delete() { |
|
||||||
assertAllocated(); |
|
||||||
DBJNI.delete(self); |
|
||||||
self = 0; |
|
||||||
} |
|
||||||
|
|
||||||
private NativeDB(long self) { |
|
||||||
super(self); |
|
||||||
} |
|
||||||
|
|
||||||
public static class DBException extends IOException { |
|
||||||
private final boolean notFound; |
|
||||||
|
|
||||||
DBException(String s, boolean notFound) { |
|
||||||
super(s); |
|
||||||
this.notFound = notFound; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean isNotFound() { |
|
||||||
return notFound; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
static void checkStatus(long s) throws DBException { |
|
||||||
NativeStatus status = new NativeStatus(s); |
|
||||||
try { |
|
||||||
if( !status.isOk() ) { |
|
||||||
throw new DBException(status.toString(), status.isNotFound()); |
|
||||||
} |
|
||||||
} finally { |
|
||||||
status.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
static void checkArgNotNull(Object value, String name) { |
|
||||||
if(value==null) { |
|
||||||
throw new IllegalArgumentException("The "+name+" argument cannot be null"); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public static NativeDB open(NativeOptions options, File path) throws IOException, DBException { |
|
||||||
checkArgNotNull(options, "options"); |
|
||||||
checkArgNotNull(path, "path"); |
|
||||||
long rc[] = new long[1]; |
|
||||||
try { |
|
||||||
checkStatus(DBJNI.Open(options, path.getCanonicalPath(), rc)); |
|
||||||
} catch (IOException e) { |
|
||||||
if( rc[0]!=0 ) { |
|
||||||
DBJNI.delete(rc[0]); |
|
||||||
} |
|
||||||
throw e; |
|
||||||
} |
|
||||||
return new NativeDB(rc[0]); |
|
||||||
} |
|
||||||
|
|
||||||
public void suspendCompactions() { |
|
||||||
DBJNI.SuspendCompactions(self); |
|
||||||
} |
|
||||||
|
|
||||||
public void resumeCompactions() { |
|
||||||
DBJNI.ResumeCompactions(self); |
|
||||||
} |
|
||||||
|
|
||||||
public void put(NativeWriteOptions options, byte[] key, byte[] value) throws DBException { |
|
||||||
checkArgNotNull(options, "options"); |
|
||||||
checkArgNotNull(key, "key"); |
|
||||||
checkArgNotNull(value, "value"); |
|
||||||
NativeBuffer keyBuffer = NativeBuffer.create(key); |
|
||||||
try { |
|
||||||
NativeBuffer valueBuffer = NativeBuffer.create(value); |
|
||||||
try { |
|
||||||
put(options, keyBuffer, valueBuffer); |
|
||||||
} finally { |
|
||||||
valueBuffer.delete(); |
|
||||||
} |
|
||||||
} finally { |
|
||||||
keyBuffer.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void put(NativeWriteOptions options, NativeBuffer keyBuffer, NativeBuffer valueBuffer) throws DBException { |
|
||||||
put(options, new NativeSlice(keyBuffer), new NativeSlice(valueBuffer)); |
|
||||||
} |
|
||||||
|
|
||||||
private void put(NativeWriteOptions options, NativeSlice keySlice, NativeSlice valueSlice) throws DBException { |
|
||||||
assertAllocated(); |
|
||||||
checkStatus(DBJNI.Put(self, options, keySlice, valueSlice)); |
|
||||||
} |
|
||||||
|
|
||||||
public void delete(NativeWriteOptions options, byte[] key) throws DBException { |
|
||||||
checkArgNotNull(options, "options"); |
|
||||||
checkArgNotNull(key, "key"); |
|
||||||
NativeBuffer keyBuffer = NativeBuffer.create(key); |
|
||||||
try { |
|
||||||
delete(options, keyBuffer); |
|
||||||
} finally { |
|
||||||
keyBuffer.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void delete(NativeWriteOptions options, NativeBuffer keyBuffer) throws DBException { |
|
||||||
delete(options, new NativeSlice(keyBuffer)); |
|
||||||
} |
|
||||||
|
|
||||||
private void delete(NativeWriteOptions options, NativeSlice keySlice) throws DBException { |
|
||||||
assertAllocated(); |
|
||||||
checkStatus(DBJNI.Delete(self, options, keySlice)); |
|
||||||
} |
|
||||||
|
|
||||||
public void write(NativeWriteOptions options, NativeWriteBatch updates) throws DBException { |
|
||||||
checkArgNotNull(options, "options"); |
|
||||||
checkArgNotNull(updates, "updates"); |
|
||||||
checkStatus(DBJNI.Write(self, options, updates.pointer())); |
|
||||||
} |
|
||||||
|
|
||||||
public byte[] get(NativeReadOptions options, byte[] key) throws DBException { |
|
||||||
checkArgNotNull(options, "options"); |
|
||||||
checkArgNotNull(key, "key"); |
|
||||||
NativeBuffer keyBuffer = NativeBuffer.create(key); |
|
||||||
try { |
|
||||||
return get(options, keyBuffer); |
|
||||||
} finally { |
|
||||||
keyBuffer.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private byte[] get(NativeReadOptions options, NativeBuffer keyBuffer) throws DBException { |
|
||||||
return get(options, new NativeSlice(keyBuffer)); |
|
||||||
} |
|
||||||
|
|
||||||
private byte[] get(NativeReadOptions options, NativeSlice keySlice) throws DBException { |
|
||||||
assertAllocated(); |
|
||||||
NativeStdString result = new NativeStdString(); |
|
||||||
try { |
|
||||||
checkStatus(DBJNI.Get(self, options, keySlice, result.pointer())); |
|
||||||
return result.toByteArray(); |
|
||||||
} finally { |
|
||||||
result.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public NativeSnapshot getSnapshot() { |
|
||||||
return new NativeSnapshot(DBJNI.GetSnapshot(self)); |
|
||||||
} |
|
||||||
|
|
||||||
public void releaseSnapshot(NativeSnapshot snapshot) { |
|
||||||
checkArgNotNull(snapshot, "snapshot"); |
|
||||||
DBJNI.ReleaseSnapshot(self, snapshot.pointer()); |
|
||||||
} |
|
||||||
|
|
||||||
public NativeIterator iterator(NativeReadOptions options) { |
|
||||||
checkArgNotNull(options, "options"); |
|
||||||
return new NativeIterator(DBJNI.NewIterator(self, options)); |
|
||||||
} |
|
||||||
|
|
||||||
public long[] getApproximateSizes(NativeRange... ranges) { |
|
||||||
if( ranges==null ) { |
|
||||||
return null; |
|
||||||
} |
|
||||||
|
|
||||||
long rc[] = new long[ranges.length]; |
|
||||||
NativeRange.RangeJNI structs[] = new NativeRange.RangeJNI[ranges.length]; |
|
||||||
if( rc.length> 0 ) { |
|
||||||
NativeBuffer range_array = NativeRange.RangeJNI.arrayCreate(ranges.length); |
|
||||||
try { |
|
||||||
for(int i=0; i < ranges.length; i++) { |
|
||||||
structs[i] = new NativeRange.RangeJNI(ranges[i]); |
|
||||||
structs[i].arrayWrite(range_array.pointer(), i); |
|
||||||
} |
|
||||||
DBJNI.GetApproximateSizes(self,range_array.pointer(), ranges.length, rc); |
|
||||||
} finally { |
|
||||||
for(int i=0; i < ranges.length; i++) { |
|
||||||
if( structs[i] != null ) { |
|
||||||
structs[i].delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
range_array.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
return rc; |
|
||||||
} |
|
||||||
|
|
||||||
public String getProperty(String name) { |
|
||||||
checkArgNotNull(name, "name"); |
|
||||||
NativeBuffer keyBuffer = NativeBuffer.create(name.getBytes()); |
|
||||||
try { |
|
||||||
byte[] property = getProperty(keyBuffer); |
|
||||||
if( property==null ) { |
|
||||||
return null; |
|
||||||
} else { |
|
||||||
return new String(property); |
|
||||||
} |
|
||||||
} finally { |
|
||||||
keyBuffer.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private byte[] getProperty(NativeBuffer nameBuffer) { |
|
||||||
return getProperty(new NativeSlice(nameBuffer)); |
|
||||||
} |
|
||||||
|
|
||||||
private byte[] getProperty(NativeSlice nameSlice) { |
|
||||||
assertAllocated(); |
|
||||||
NativeStdString result = new NativeStdString(); |
|
||||||
try { |
|
||||||
if( DBJNI.GetProperty(self, nameSlice, result.pointer()) ) { |
|
||||||
return result.toByteArray(); |
|
||||||
} else { |
|
||||||
return null; |
|
||||||
} |
|
||||||
} finally { |
|
||||||
result.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public void compactRange(byte[] begin, byte[] end) { |
|
||||||
NativeBuffer keyBuffer = NativeBuffer.create(begin); |
|
||||||
try { |
|
||||||
NativeBuffer valueBuffer = NativeBuffer.create(end); |
|
||||||
try { |
|
||||||
compactRange(keyBuffer, valueBuffer); |
|
||||||
} finally { |
|
||||||
if( valueBuffer!=null ) { |
|
||||||
valueBuffer.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
} finally { |
|
||||||
if( keyBuffer!=null ) { |
|
||||||
keyBuffer.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void compactRange( NativeBuffer beginBuffer, NativeBuffer endBuffer) { |
|
||||||
compactRange(NativeSlice.create(beginBuffer), NativeSlice.create(endBuffer)); |
|
||||||
} |
|
||||||
|
|
||||||
private void compactRange( NativeSlice beginSlice, NativeSlice endSlice) { |
|
||||||
assertAllocated(); |
|
||||||
DBJNI.CompactRange(self, beginSlice, endSlice); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
static public void destroy(File path, NativeOptions options) throws IOException, DBException { |
|
||||||
checkArgNotNull(options, "options"); |
|
||||||
checkArgNotNull(path, "path"); |
|
||||||
checkStatus(DBJNI.DestroyDB(path.getCanonicalPath(), options)); |
|
||||||
} |
|
||||||
|
|
||||||
static public void repair(File path, NativeOptions options) throws IOException, DBException { |
|
||||||
checkArgNotNull(options, "options"); |
|
||||||
checkArgNotNull(path, "path"); |
|
||||||
checkStatus(DBJNI.RepairDB(path.getCanonicalPath(), options)); |
|
||||||
} |
|
||||||
} |
|
@ -1,191 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.*; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.*; |
|
||||||
import static org.fusesource.hawtjni.runtime.ArgFlag.*; |
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* Provides a java interface to the C++ rocksdb::Iterator class. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class NativeIterator extends NativeObject { |
|
||||||
|
|
||||||
@JniClass(name="rocksdb::Iterator", flags={CPP}) |
|
||||||
private static class IteratorJNI { |
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
} |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_DELETE}) |
|
||||||
public static final native void delete( |
|
||||||
long self |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native boolean Valid( |
|
||||||
long self |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native void SeekToFirst( |
|
||||||
long self |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native void SeekToLast( |
|
||||||
long self |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native void Seek( |
|
||||||
long self, |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeSlice target |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native void Next( |
|
||||||
long self |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native void Prev( |
|
||||||
long self |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(copy="rocksdb::Slice", flags={CPP_METHOD}) |
|
||||||
static final native long key( |
|
||||||
long self |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(copy="rocksdb::Slice", flags={CPP_METHOD}) |
|
||||||
static final native long value( |
|
||||||
long self |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(copy="rocksdb::Status", flags={CPP_METHOD}) |
|
||||||
static final native long status( |
|
||||||
long self |
|
||||||
); |
|
||||||
} |
|
||||||
|
|
||||||
NativeIterator(long self) { |
|
||||||
super(self); |
|
||||||
} |
|
||||||
|
|
||||||
public void delete() { |
|
||||||
assertAllocated(); |
|
||||||
IteratorJNI.delete(self); |
|
||||||
self = 0; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean isValid() { |
|
||||||
assertAllocated(); |
|
||||||
return IteratorJNI.Valid(self); |
|
||||||
} |
|
||||||
|
|
||||||
private void checkStatus() throws NativeDB.DBException { |
|
||||||
NativeDB.checkStatus(IteratorJNI.status(self)); |
|
||||||
} |
|
||||||
|
|
||||||
public void seekToFirst() { |
|
||||||
assertAllocated(); |
|
||||||
IteratorJNI.SeekToFirst(self); |
|
||||||
} |
|
||||||
|
|
||||||
public void seekToLast() { |
|
||||||
assertAllocated(); |
|
||||||
IteratorJNI.SeekToLast(self); |
|
||||||
} |
|
||||||
|
|
||||||
public void seek(byte[] key) throws NativeDB.DBException { |
|
||||||
NativeDB.checkArgNotNull(key, "key"); |
|
||||||
NativeBuffer keyBuffer = NativeBuffer.create(key); |
|
||||||
try { |
|
||||||
seek(keyBuffer); |
|
||||||
} finally { |
|
||||||
keyBuffer.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void seek(NativeBuffer keyBuffer) throws NativeDB.DBException { |
|
||||||
seek(new NativeSlice(keyBuffer)); |
|
||||||
} |
|
||||||
|
|
||||||
private void seek(NativeSlice keySlice) throws NativeDB.DBException { |
|
||||||
assertAllocated(); |
|
||||||
IteratorJNI.Seek(self, keySlice); |
|
||||||
checkStatus(); |
|
||||||
} |
|
||||||
|
|
||||||
public void next() throws NativeDB.DBException { |
|
||||||
assertAllocated(); |
|
||||||
IteratorJNI.Next(self); |
|
||||||
checkStatus(); |
|
||||||
} |
|
||||||
|
|
||||||
public void prev() throws NativeDB.DBException { |
|
||||||
assertAllocated(); |
|
||||||
IteratorJNI.Prev(self); |
|
||||||
checkStatus(); |
|
||||||
} |
|
||||||
|
|
||||||
public byte[] key() throws NativeDB.DBException { |
|
||||||
assertAllocated(); |
|
||||||
long slice_ptr = IteratorJNI.key(self); |
|
||||||
checkStatus(); |
|
||||||
try { |
|
||||||
NativeSlice slice = new NativeSlice(); |
|
||||||
slice.read(slice_ptr, 0); |
|
||||||
return slice.toByteArray(); |
|
||||||
} finally { |
|
||||||
NativeSlice.SliceJNI.delete(slice_ptr); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public byte[] value() throws NativeDB.DBException { |
|
||||||
assertAllocated(); |
|
||||||
long slice_ptr = IteratorJNI.value(self); |
|
||||||
checkStatus(); |
|
||||||
try { |
|
||||||
NativeSlice slice = new NativeSlice(); |
|
||||||
slice.read(slice_ptr, 0); |
|
||||||
return slice.toByteArray(); |
|
||||||
} finally { |
|
||||||
NativeSlice.SliceJNI.delete(slice_ptr); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
@ -1,126 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.JniArg; |
|
||||||
import org.fusesource.hawtjni.runtime.JniClass; |
|
||||||
import org.fusesource.hawtjni.runtime.JniField; |
|
||||||
import org.fusesource.hawtjni.runtime.JniMethod; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.ArgFlag.CRITICAL; |
|
||||||
import static org.fusesource.hawtjni.runtime.ArgFlag.NO_OUT; |
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; |
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.STRUCT; |
|
||||||
import static org.fusesource.hawtjni.runtime.FieldFlag.CONSTANT; |
|
||||||
import static org.fusesource.hawtjni.runtime.FieldFlag.POINTER_FIELD; |
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* <p> |
|
||||||
* Provides a java interface to the C++ rocksdb::Logger class. |
|
||||||
* </p> |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public abstract class NativeLogger extends NativeObject { |
|
||||||
|
|
||||||
@JniClass(name="JNILogger", flags={STRUCT, CPP}) |
|
||||||
static public class LoggerJNI { |
|
||||||
|
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
init(); |
|
||||||
} |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_NEW}) |
|
||||||
public static final native long create(); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_DELETE}) |
|
||||||
public static final native void delete( |
|
||||||
long self |
|
||||||
); |
|
||||||
|
|
||||||
public static final native void memmove ( |
|
||||||
@JniArg(cast="void *") long dest, |
|
||||||
@JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) LoggerJNI src, |
|
||||||
@JniArg(cast="size_t") long size); |
|
||||||
|
|
||||||
@JniField(cast="jobject", flags={POINTER_FIELD}) |
|
||||||
long target; |
|
||||||
|
|
||||||
@JniField(cast="jmethodID", flags={POINTER_FIELD}) |
|
||||||
long log_method; |
|
||||||
|
|
||||||
@JniMethod(flags={CONSTANT_INITIALIZER}) |
|
||||||
private static final native void init(); |
|
||||||
|
|
||||||
@JniField(flags={CONSTANT}, accessor="sizeof(struct JNILogger)") |
|
||||||
static int SIZEOF; |
|
||||||
} |
|
||||||
|
|
||||||
private long globalRef; |
|
||||||
|
|
||||||
public NativeLogger() { |
|
||||||
super(LoggerJNI.create()); |
|
||||||
try { |
|
||||||
globalRef = NativeDB.DBJNI.NewGlobalRef(this); |
|
||||||
if( globalRef==0 ) { |
|
||||||
throw new RuntimeException("jni call failed: NewGlobalRef"); |
|
||||||
} |
|
||||||
LoggerJNI struct = new LoggerJNI(); |
|
||||||
struct.log_method = NativeDB.DBJNI.GetMethodID(this.getClass(), "log", "(Ljava/lang/String;)V"); |
|
||||||
if( struct.log_method ==0 ) { |
|
||||||
throw new RuntimeException("jni call failed: GetMethodID"); |
|
||||||
} |
|
||||||
struct.target = globalRef; |
|
||||||
LoggerJNI.memmove(self, struct, LoggerJNI.SIZEOF); |
|
||||||
|
|
||||||
} catch (RuntimeException e) { |
|
||||||
delete(); |
|
||||||
throw e; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
NativeLogger(long ptr) { |
|
||||||
super(ptr); |
|
||||||
} |
|
||||||
|
|
||||||
public void delete() { |
|
||||||
if( globalRef!=0 ) { |
|
||||||
NativeDB.DBJNI.DeleteGlobalRef(globalRef); |
|
||||||
globalRef = 0; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public abstract void log(String message); |
|
||||||
|
|
||||||
} |
|
@ -1,63 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
/** |
|
||||||
* A helper base class which is used to track a pointer to a native |
|
||||||
* structure or class. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
class NativeObject { |
|
||||||
|
|
||||||
protected long self; |
|
||||||
|
|
||||||
protected NativeObject(long self) { |
|
||||||
this.self = self; |
|
||||||
if( self ==0 ) { |
|
||||||
throw new OutOfMemoryError("Failure allocating native heap memory"); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
long pointer() { |
|
||||||
return self; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean isAllocated() { |
|
||||||
return self !=0; |
|
||||||
} |
|
||||||
|
|
||||||
protected void assertAllocated() { |
|
||||||
assert isAllocated() : "This object has been deleted"; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,465 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.JniClass; |
|
||||||
import org.fusesource.hawtjni.runtime.JniField; |
|
||||||
import org.fusesource.hawtjni.runtime.JniMethod; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; |
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.STRUCT; |
|
||||||
import static org.fusesource.hawtjni.runtime.FieldFlag.CONSTANT; |
|
||||||
import static org.fusesource.hawtjni.runtime.FieldFlag.FIELD_SKIP; |
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.CONSTANT_INITIALIZER; |
|
||||||
|
|
||||||
/** |
|
||||||
* Provides a java interface to the C++ rocksdb::Options class. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
@JniClass(name="rocksdb::Options", flags={STRUCT, CPP}) |
|
||||||
public class NativeOptions { |
|
||||||
|
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
init(); |
|
||||||
} |
|
||||||
|
|
||||||
@JniMethod(flags={CONSTANT_INITIALIZER}) |
|
||||||
private static final native void init(); |
|
||||||
|
|
||||||
@JniField(flags={CONSTANT}, cast="Env*", accessor="rocksdb::Env::Default()") |
|
||||||
private static long DEFAULT_ENV; |
|
||||||
|
|
||||||
private boolean create_if_missing = false; |
|
||||||
private boolean error_if_exists = false; |
|
||||||
private boolean paranoid_checks = false; |
|
||||||
@JniField(cast="size_t") |
|
||||||
private long write_buffer_size = 4 << 20; |
|
||||||
@JniField(cast="size_t") |
|
||||||
private long max_write_buffer_number = 2; |
|
||||||
@JniField(cast="size_t") |
|
||||||
private long block_size = 4086; |
|
||||||
private int max_open_files = 1000; |
|
||||||
private int block_restart_interval = 16; |
|
||||||
private boolean no_block_cache = false; |
|
||||||
private boolean use_fsync = false; |
|
||||||
private int num_levels = 7; |
|
||||||
private int level0_file_num_compaction_trigger = 4; |
|
||||||
private int level0_slowdown_writes_trigger = 8; |
|
||||||
private int level0_stop_writes_trigger = 12; |
|
||||||
private int max_mem_compaction_level = 2; |
|
||||||
private int target_file_size_base = 2 * 1048576; |
|
||||||
private int target_file_size_multiplier = 1; |
|
||||||
|
|
||||||
@JniField(flags={FIELD_SKIP}) |
|
||||||
private NativeComparator comparatorObject = NativeComparator.BYTEWISE_COMPARATOR; |
|
||||||
@JniField(cast="const rocksdb::Comparator*") |
|
||||||
private long comparator = comparatorObject.pointer(); |
|
||||||
|
|
||||||
@JniField(cast="uint64_t") |
|
||||||
private long max_bytes_for_level_base = 10 * 1048576; |
|
||||||
private int max_bytes_for_level_multiplier = 10; |
|
||||||
private int expanded_compaction_factor = 25; |
|
||||||
private int source_compaction_factor = 1; |
|
||||||
private int max_grandparent_overlap_factor = 10; |
|
||||||
private boolean disableDataSync = false; |
|
||||||
private int db_stats_log_interval = 1800; |
|
||||||
private boolean disable_seek_compaction = false; |
|
||||||
@JniField(cast="uint64_t") |
|
||||||
private long delete_obsolete_files_period_micros = 0; |
|
||||||
private int max_background_compactions = 1; |
|
||||||
|
|
||||||
@JniField(cast="size_t") |
|
||||||
private long max_log_file_size = 0; |
|
||||||
private double rate_limit = 0.0; |
|
||||||
private int table_cache_numshardbits = 4; |
|
||||||
private boolean disable_auto_compactions = false; |
|
||||||
|
|
||||||
@JniField(cast="uint64_t") |
|
||||||
private long WAL_ttl_seconds = 0; |
|
||||||
|
|
||||||
@JniField(flags={FIELD_SKIP}) |
|
||||||
private NativeLogger infoLogObject = null; |
|
||||||
@JniField(cast="rocksdb::Logger*") |
|
||||||
private long info_log = 0; |
|
||||||
|
|
||||||
@JniField(cast="rocksdb::Env*") |
|
||||||
private long env = DEFAULT_ENV; |
|
||||||
@JniField(cast="rocksdb::Cache*") |
|
||||||
private long block_cache = 0; |
|
||||||
@JniField(flags={FIELD_SKIP}) |
|
||||||
private NativeCache cache; |
|
||||||
|
|
||||||
@JniField(cast="rocksdb::CompressionType") |
|
||||||
private int compression = NativeCompressionType.kSnappyCompression.value; |
|
||||||
|
|
||||||
public NativeOptions createIfMissing(boolean value) { |
|
||||||
this.create_if_missing = value; |
|
||||||
return this; |
|
||||||
} |
|
||||||
public boolean createIfMissing() { |
|
||||||
return create_if_missing; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions errorIfExists(boolean value) { |
|
||||||
this.error_if_exists = value; |
|
||||||
return this; |
|
||||||
} |
|
||||||
public boolean errorIfExists() { |
|
||||||
return error_if_exists; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions paranoidChecks(boolean value) { |
|
||||||
this.paranoid_checks = value; |
|
||||||
return this; |
|
||||||
} |
|
||||||
public boolean paranoidChecks() { |
|
||||||
return paranoid_checks; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions writeBufferSize(long value) { |
|
||||||
this.write_buffer_size = value; |
|
||||||
return this; |
|
||||||
} |
|
||||||
public long writeBufferSize() { |
|
||||||
return write_buffer_size; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions maxOpenFiles(int value) { |
|
||||||
this.max_open_files = value; |
|
||||||
return this; |
|
||||||
} |
|
||||||
public int maxOpenFiles() { |
|
||||||
return max_open_files; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions blockRestartInterval(int value) { |
|
||||||
this.block_restart_interval = value; |
|
||||||
return this; |
|
||||||
} |
|
||||||
public int blockRestartInterval() { |
|
||||||
return block_restart_interval; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions blockSize(long value) { |
|
||||||
this.block_size = value; |
|
||||||
return this; |
|
||||||
} |
|
||||||
public long blockSize() { |
|
||||||
return block_size; |
|
||||||
} |
|
||||||
|
|
||||||
// @JniField(cast="Env*")
|
|
||||||
// private long env = DEFAULT_ENV;
|
|
||||||
|
|
||||||
public NativeComparator comparator() { |
|
||||||
return comparatorObject; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions comparator(NativeComparator comparator) { |
|
||||||
if( comparator==null ) { |
|
||||||
throw new IllegalArgumentException("comparator cannot be null"); |
|
||||||
} |
|
||||||
this.comparatorObject = comparator; |
|
||||||
this.comparator = comparator.pointer(); |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeLogger infoLog() { |
|
||||||
return infoLogObject; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions infoLog(NativeLogger logger) { |
|
||||||
this.infoLogObject = logger; |
|
||||||
if( logger ==null ) { |
|
||||||
this.info_log = 0; |
|
||||||
} else { |
|
||||||
this.info_log = logger.pointer(); |
|
||||||
} |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeCompressionType compression() { |
|
||||||
if(compression == NativeCompressionType.kNoCompression.value) { |
|
||||||
return NativeCompressionType.kNoCompression; |
|
||||||
} else if(compression == NativeCompressionType.kSnappyCompression.value) { |
|
||||||
return NativeCompressionType.kSnappyCompression; |
|
||||||
} else { |
|
||||||
return NativeCompressionType.kSnappyCompression; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions compression(NativeCompressionType compression) { |
|
||||||
this.compression = compression.value; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeCache cache() { |
|
||||||
return cache; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions cache(NativeCache cache) { |
|
||||||
this.cache = cache; |
|
||||||
if( cache!=null ) { |
|
||||||
this.block_cache = cache.pointer(); |
|
||||||
} else { |
|
||||||
this.block_cache = 0; |
|
||||||
} |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int numLevels() { |
|
||||||
return this.num_levels; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions numLevels(int numLevels) { |
|
||||||
this.num_levels = numLevels; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int level0FileNumCompactionTrigger() { |
|
||||||
return this.level0_file_num_compaction_trigger; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions level0FileNumCompactionTrigger(int n) { |
|
||||||
this.level0_file_num_compaction_trigger = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int level0SlowdownWritesTrigger() { |
|
||||||
return this.level0_slowdown_writes_trigger; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions level0SlowdownWritesTrigger(int n) { |
|
||||||
this.level0_slowdown_writes_trigger = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int level0StopWritesTrigger() { |
|
||||||
return this.level0_stop_writes_trigger; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions level0StopWritesTrigger(int n) { |
|
||||||
this.level0_stop_writes_trigger = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int maxMemCompactionLevel() { |
|
||||||
return this.max_mem_compaction_level; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions maxMemCompactionLevel(int n) { |
|
||||||
this.max_mem_compaction_level = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int targetFileSizeBase() { |
|
||||||
return this.target_file_size_base; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions targetFileSizeBase(int n) { |
|
||||||
this.target_file_size_base = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int targetFileSizeMultiplier() { |
|
||||||
return this.target_file_size_multiplier; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions targetFileSizeMultiplier(int n) { |
|
||||||
this.target_file_size_multiplier = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public long maxBytesLevelBase() { |
|
||||||
return this.max_bytes_for_level_base; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions maxBytesLevelBase(long n) { |
|
||||||
this.max_bytes_for_level_base = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int maxBytesLevelMultiplier() { |
|
||||||
return this.max_bytes_for_level_multiplier; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions maxBytesLevelMultiplier(int n) { |
|
||||||
this.max_bytes_for_level_multiplier = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int expandedCompactionFactor() { |
|
||||||
return this.expanded_compaction_factor; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions expandedCompactionFactor(int n) { |
|
||||||
this.expanded_compaction_factor = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int sourceCompactionFactor() { |
|
||||||
return this.source_compaction_factor; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions sourceCompactionFactor(int n) { |
|
||||||
this.source_compaction_factor = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int maxGrandparentOverlapFactor() { |
|
||||||
return this.max_grandparent_overlap_factor; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions maxGrandparentOverlapFactor(int n) { |
|
||||||
this.max_grandparent_overlap_factor = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean disableDataSync() { |
|
||||||
return this.disableDataSync; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions disableDataSync(boolean flag) { |
|
||||||
this.disableDataSync = flag; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int dbStatsLogInterval() { |
|
||||||
return this.db_stats_log_interval; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions dbStatsLogInterval(int n) { |
|
||||||
this.db_stats_log_interval = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean disableSeekCompaction() { |
|
||||||
return this.disable_seek_compaction; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions disableSeekCompaction(boolean flag) { |
|
||||||
this.disable_seek_compaction = flag; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public long deleteObsoleteFilesMicros() { |
|
||||||
return this.delete_obsolete_files_period_micros; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions deleteObsoleteFilesMicros(long micros) { |
|
||||||
this.delete_obsolete_files_period_micros = micros; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int maxBackgroundCompactions() { |
|
||||||
return this.max_background_compactions; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions maxBackgroundCompactions(int n) { |
|
||||||
this.max_background_compactions = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public long maxLogFileSize() { |
|
||||||
return this.max_log_file_size; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions maxLogFileSize(long s) { |
|
||||||
this.max_log_file_size = s; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public double rateLimit() { |
|
||||||
return this.rate_limit; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions rateLimit(double rate) { |
|
||||||
this.rate_limit = rate; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public int tableCacheNumShardBits() { |
|
||||||
return this.table_cache_numshardbits; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions tableCacheNumShardBits(int n) { |
|
||||||
this.table_cache_numshardbits = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean disableAutoCompactions() { |
|
||||||
return this.disable_auto_compactions; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions disableAutoCompactions(boolean b) { |
|
||||||
this.disable_auto_compactions = b; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public long WALttlSeconds() { |
|
||||||
return this.WAL_ttl_seconds; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions WALttlSeconds(long n) { |
|
||||||
this.WAL_ttl_seconds = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean noBlockCache() { |
|
||||||
return this.no_block_cache; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions noBlockCache(boolean b) { |
|
||||||
this.no_block_cache = b; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean useFsync() { |
|
||||||
return this.use_fsync; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions useFsync(boolean b) { |
|
||||||
this.use_fsync = b; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public long maxWriteBufferNumber() { |
|
||||||
return this.max_write_buffer_number; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeOptions maxWriteBufferNumber(long n) { |
|
||||||
this.max_write_buffer_number = n; |
|
||||||
return this; |
|
||||||
} |
|
||||||
} |
|
@ -1,133 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.*; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.ArgFlag.*; |
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; |
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.STRUCT; |
|
||||||
import static org.fusesource.hawtjni.runtime.FieldFlag.CONSTANT; |
|
||||||
import static org.fusesource.hawtjni.runtime.FieldFlag.FIELD_SKIP; |
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.CONSTANT_INITIALIZER; |
|
||||||
|
|
||||||
/** |
|
||||||
* Provides a java interface to the C++ rocksdb::ReadOptions class. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class NativeRange { |
|
||||||
|
|
||||||
@JniClass(name="rocksdb::Range", flags={STRUCT, CPP}) |
|
||||||
static public class RangeJNI { |
|
||||||
|
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
init(); |
|
||||||
} |
|
||||||
|
|
||||||
public static final native void memmove ( |
|
||||||
@JniArg(cast="void *") long dest, |
|
||||||
@JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) RangeJNI src, |
|
||||||
@JniArg(cast="size_t") long size); |
|
||||||
|
|
||||||
public static final native void memmove ( |
|
||||||
@JniArg(cast="void *", flags={NO_IN, CRITICAL}) RangeJNI dest, |
|
||||||
@JniArg(cast="const void *") long src, |
|
||||||
@JniArg(cast="size_t") long size); |
|
||||||
|
|
||||||
|
|
||||||
@JniMethod(flags={CONSTANT_INITIALIZER}) |
|
||||||
private static final native void init(); |
|
||||||
|
|
||||||
@JniField(flags={CONSTANT}, accessor="sizeof(struct rocksdb::Range)") |
|
||||||
static int SIZEOF; |
|
||||||
|
|
||||||
@JniField |
|
||||||
NativeSlice start = new NativeSlice(); |
|
||||||
@JniField(flags={FIELD_SKIP}) |
|
||||||
NativeBuffer start_buffer; |
|
||||||
|
|
||||||
@JniField |
|
||||||
NativeSlice limit = new NativeSlice(); |
|
||||||
@JniField(flags={FIELD_SKIP}) |
|
||||||
NativeBuffer limit_buffer; |
|
||||||
|
|
||||||
public RangeJNI(NativeRange range) { |
|
||||||
start_buffer = NativeBuffer.create(range.start()); |
|
||||||
start.set(start_buffer); |
|
||||||
try { |
|
||||||
limit_buffer = NativeBuffer.create(range.limit()); |
|
||||||
} catch (OutOfMemoryError e) { |
|
||||||
start_buffer.delete(); |
|
||||||
throw e; |
|
||||||
} |
|
||||||
limit.set(limit_buffer); |
|
||||||
} |
|
||||||
|
|
||||||
public void delete() { |
|
||||||
start_buffer.delete(); |
|
||||||
limit_buffer.delete(); |
|
||||||
} |
|
||||||
|
|
||||||
static NativeBuffer arrayCreate(int dimension) { |
|
||||||
return NativeBuffer.create(dimension*SIZEOF); |
|
||||||
} |
|
||||||
|
|
||||||
void arrayWrite(long buffer, int index) { |
|
||||||
RangeJNI.memmove(PointerMath.add(buffer, SIZEOF * index), this, SIZEOF); |
|
||||||
} |
|
||||||
|
|
||||||
void arrayRead(long buffer, int index) { |
|
||||||
RangeJNI.memmove(this, PointerMath.add(buffer, SIZEOF * index), SIZEOF); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
final private byte[] start; |
|
||||||
final private byte[] limit; |
|
||||||
|
|
||||||
public byte[] limit() { |
|
||||||
return limit; |
|
||||||
} |
|
||||||
|
|
||||||
public byte[] start() { |
|
||||||
return start; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeRange(byte[] start, byte[] limit) { |
|
||||||
NativeDB.checkArgNotNull(start, "start"); |
|
||||||
NativeDB.checkArgNotNull(limit, "limit"); |
|
||||||
this.limit = limit; |
|
||||||
this.start = start; |
|
||||||
} |
|
||||||
} |
|
@ -1,91 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.JniClass; |
|
||||||
import org.fusesource.hawtjni.runtime.JniField; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; |
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.STRUCT; |
|
||||||
|
|
||||||
/** |
|
||||||
* Provides a java interface to the C++ rocksdb::ReadOptions class. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
@JniClass(name="rocksdb::ReadOptions", flags={STRUCT, CPP}) |
|
||||||
public class NativeReadOptions { |
|
||||||
|
|
||||||
@JniField |
|
||||||
private boolean verify_checksums = false; |
|
||||||
|
|
||||||
@JniField |
|
||||||
private boolean fill_cache = true; |
|
||||||
|
|
||||||
@JniField(cast="const rocksdb::Snapshot*") |
|
||||||
private long snapshot=0; |
|
||||||
|
|
||||||
public boolean fillCache() { |
|
||||||
return fill_cache; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeReadOptions fillCache(boolean fill_cache) { |
|
||||||
this.fill_cache = fill_cache; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeSnapshot snapshot() { |
|
||||||
if( snapshot == 0 ) { |
|
||||||
return null; |
|
||||||
} else { |
|
||||||
return new NativeSnapshot(snapshot); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public NativeReadOptions snapshot(NativeSnapshot snapshot) { |
|
||||||
if( snapshot==null ) { |
|
||||||
this.snapshot = 0; |
|
||||||
} else { |
|
||||||
this.snapshot = snapshot.pointer(); |
|
||||||
} |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean verifyChecksums() { |
|
||||||
return verify_checksums; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeReadOptions verifyChecksums(boolean verify_checksums) { |
|
||||||
this.verify_checksums = verify_checksums; |
|
||||||
return this; |
|
||||||
} |
|
||||||
} |
|
@ -1,160 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.*; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.ArgFlag.*; |
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; |
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.STRUCT; |
|
||||||
import static org.fusesource.hawtjni.runtime.FieldFlag.CONSTANT; |
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.CONSTANT_INITIALIZER; |
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.CPP_DELETE; |
|
||||||
|
|
||||||
/** |
|
||||||
* Provides a java interface to the C++ rocksdb::Slice class. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
@JniClass(name="rocksdb::Slice", flags={STRUCT, CPP}) |
|
||||||
class NativeSlice { |
|
||||||
|
|
||||||
@JniClass(name="rocksdb::Slice", flags={CPP}) |
|
||||||
static class SliceJNI { |
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
init(); |
|
||||||
} |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_DELETE}) |
|
||||||
public static final native void delete( |
|
||||||
long self |
|
||||||
); |
|
||||||
|
|
||||||
public static final native void memmove ( |
|
||||||
@JniArg(cast="void *") long dest, |
|
||||||
@JniArg(cast="const void *", flags={NO_OUT, CRITICAL}) NativeSlice src, |
|
||||||
@JniArg(cast="size_t") long size); |
|
||||||
|
|
||||||
public static final native void memmove ( |
|
||||||
@JniArg(cast="void *", flags={NO_IN, CRITICAL}) NativeSlice dest, |
|
||||||
@JniArg(cast="const void *") long src, |
|
||||||
@JniArg(cast="size_t") long size); |
|
||||||
|
|
||||||
|
|
||||||
@JniMethod(flags={CONSTANT_INITIALIZER}) |
|
||||||
private static final native void init(); |
|
||||||
|
|
||||||
@JniField(flags={CONSTANT}, accessor="sizeof(struct rocksdb::Slice)") |
|
||||||
static int SIZEOF; |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
@JniField(cast="const char*") |
|
||||||
private long data_; |
|
||||||
@JniField(cast="size_t") |
|
||||||
private long size_; |
|
||||||
|
|
||||||
public NativeSlice() { |
|
||||||
} |
|
||||||
|
|
||||||
public NativeSlice(long data, long length) { |
|
||||||
this.data_ = data; |
|
||||||
this.size_ = length; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeSlice(NativeBuffer buffer) { |
|
||||||
this(buffer.pointer(), buffer.capacity()); |
|
||||||
} |
|
||||||
|
|
||||||
public static NativeSlice create(NativeBuffer buffer) { |
|
||||||
if(buffer == null ) { |
|
||||||
return null; |
|
||||||
} else { |
|
||||||
return new NativeSlice(buffer); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
public long data() { |
|
||||||
return data_; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeSlice data(long data) { |
|
||||||
this.data_ = data; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public long size() { |
|
||||||
return size_; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeSlice size(long size) { |
|
||||||
this.size_ = size; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeSlice set(NativeSlice buffer) { |
|
||||||
this.size_ = buffer.size_; |
|
||||||
this.data_ = buffer.data_; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeSlice set(NativeBuffer buffer) { |
|
||||||
this.size_ = buffer.capacity(); |
|
||||||
this.data_ = buffer.pointer(); |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
public byte[] toByteArray() { |
|
||||||
if( size_ > Integer.MAX_VALUE ) { |
|
||||||
throw new ArrayIndexOutOfBoundsException("Native slice is larger than the maximum Java array"); |
|
||||||
} |
|
||||||
byte []rc = new byte[(int) size_]; |
|
||||||
NativeBuffer.NativeBufferJNI.buffer_copy(data_, 0, rc, 0, rc.length); |
|
||||||
return rc; |
|
||||||
} |
|
||||||
|
|
||||||
static NativeBuffer arrayCreate(int dimension) { |
|
||||||
return NativeBuffer.create(dimension*SliceJNI.SIZEOF); |
|
||||||
} |
|
||||||
|
|
||||||
void write(long buffer, int index) { |
|
||||||
SliceJNI.memmove(PointerMath.add(buffer, SliceJNI.SIZEOF*index), this, SliceJNI.SIZEOF); |
|
||||||
} |
|
||||||
|
|
||||||
void read(long buffer, int index) { |
|
||||||
SliceJNI.memmove(this, PointerMath.add(buffer, SliceJNI.SIZEOF*index), SliceJNI.SIZEOF); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
} |
|
@ -1,45 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
/** |
|
||||||
* Provides a java interface to the C++ rocksdb::Snapshot class. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class NativeSnapshot extends NativeObject { |
|
||||||
|
|
||||||
NativeSnapshot(long self) { |
|
||||||
super(self); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,106 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.JniClass; |
|
||||||
import org.fusesource.hawtjni.runtime.JniMethod; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; |
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.CPP_DELETE; |
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.CPP_METHOD; |
|
||||||
|
|
||||||
/** |
|
||||||
* Provides a java interface to the C++ rocksdb::Status class. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
class NativeStatus extends NativeObject{ |
|
||||||
|
|
||||||
@JniClass(name="rocksdb::Status", flags={CPP}) |
|
||||||
static class StatusJNI { |
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
} |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_DELETE}) |
|
||||||
public static final native void delete( |
|
||||||
long self); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
public static final native boolean ok( |
|
||||||
long self); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
public static final native boolean IsNotFound( |
|
||||||
long self); |
|
||||||
|
|
||||||
@JniMethod(copy="std::string", flags={CPP_METHOD}) |
|
||||||
public static final native long ToString( |
|
||||||
long self); |
|
||||||
} |
|
||||||
|
|
||||||
public NativeStatus(long self) { |
|
||||||
super(self); |
|
||||||
} |
|
||||||
|
|
||||||
public void delete() { |
|
||||||
assertAllocated(); |
|
||||||
StatusJNI.delete(self); |
|
||||||
self = 0; |
|
||||||
} |
|
||||||
|
|
||||||
public boolean isOk() { |
|
||||||
assertAllocated(); |
|
||||||
return StatusJNI.ok(self); |
|
||||||
} |
|
||||||
|
|
||||||
public boolean isNotFound() { |
|
||||||
assertAllocated(); |
|
||||||
return StatusJNI.IsNotFound(self); |
|
||||||
} |
|
||||||
|
|
||||||
public String toString() { |
|
||||||
assertAllocated(); |
|
||||||
long strptr = StatusJNI.ToString(self); |
|
||||||
if( strptr==0 ) { |
|
||||||
return null; |
|
||||||
} else { |
|
||||||
NativeStdString rc = new NativeStdString(strptr); |
|
||||||
try { |
|
||||||
return rc.toString(); |
|
||||||
} finally { |
|
||||||
rc.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,105 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.JniClass; |
|
||||||
import org.fusesource.hawtjni.runtime.JniMethod; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; |
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* Provides a java interface to the C++ std::string class. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
class NativeStdString extends NativeObject { |
|
||||||
|
|
||||||
@JniClass(name="std::string", flags={CPP}) |
|
||||||
private static class StdStringJNI { |
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
} |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_NEW}) |
|
||||||
public static final native long create(); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_NEW}) |
|
||||||
public static final native long create(String value); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_DELETE}) |
|
||||||
static final native void delete( |
|
||||||
long self); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}, accessor = "c_str", cast="const char*") |
|
||||||
public static final native long c_str_ptr ( |
|
||||||
long self); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD},cast = "size_t") |
|
||||||
public static final native long length ( |
|
||||||
long self); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
public NativeStdString(long self) { |
|
||||||
super(self); |
|
||||||
} |
|
||||||
|
|
||||||
public NativeStdString() { |
|
||||||
super(StdStringJNI.create()); |
|
||||||
} |
|
||||||
|
|
||||||
public void delete() { |
|
||||||
assertAllocated(); |
|
||||||
StdStringJNI.delete(self); |
|
||||||
self = 0; |
|
||||||
} |
|
||||||
|
|
||||||
public String toString() { |
|
||||||
return new String(toByteArray()); |
|
||||||
} |
|
||||||
|
|
||||||
public long length() { |
|
||||||
assertAllocated(); |
|
||||||
return StdStringJNI.length(self); |
|
||||||
} |
|
||||||
|
|
||||||
public byte[] toByteArray() { |
|
||||||
long l = length(); |
|
||||||
if( l > Integer.MAX_VALUE ) { |
|
||||||
throw new ArrayIndexOutOfBoundsException("Native string is larger than the maximum Java array"); |
|
||||||
} |
|
||||||
byte []rc = new byte[(int) l]; |
|
||||||
NativeBuffer.NativeBufferJNI.buffer_copy(StdStringJNI.c_str_ptr(self), 0, rc, 0, rc.length); |
|
||||||
return rc; |
|
||||||
} |
|
||||||
} |
|
@ -1,142 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.JniArg; |
|
||||||
import org.fusesource.hawtjni.runtime.JniClass; |
|
||||||
import org.fusesource.hawtjni.runtime.JniMethod; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.ArgFlag.BY_VALUE; |
|
||||||
import static org.fusesource.hawtjni.runtime.ArgFlag.NO_OUT; |
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; |
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* Provides a java interface to the C++ rocksdb::WriteBatch class. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class NativeWriteBatch extends NativeObject { |
|
||||||
|
|
||||||
@JniClass(name="rocksdb::WriteBatch", flags={CPP}) |
|
||||||
private static class WriteBatchJNI { |
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
} |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_NEW}) |
|
||||||
public static final native long create(); |
|
||||||
@JniMethod(flags={CPP_DELETE}) |
|
||||||
public static final native void delete( |
|
||||||
long self); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native void Put( |
|
||||||
long self, |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeSlice key, |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeSlice value |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native void Delete( |
|
||||||
long self, |
|
||||||
@JniArg(flags={BY_VALUE, NO_OUT}) NativeSlice key |
|
||||||
); |
|
||||||
|
|
||||||
@JniMethod(flags={CPP_METHOD}) |
|
||||||
static final native void Clear( |
|
||||||
long self |
|
||||||
); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
public NativeWriteBatch() { |
|
||||||
super(WriteBatchJNI.create()); |
|
||||||
} |
|
||||||
|
|
||||||
public void delete() { |
|
||||||
assertAllocated(); |
|
||||||
WriteBatchJNI.delete(self); |
|
||||||
self = 0; |
|
||||||
} |
|
||||||
|
|
||||||
public void put(byte[] key, byte[] value) { |
|
||||||
NativeDB.checkArgNotNull(key, "key"); |
|
||||||
NativeDB.checkArgNotNull(value, "value"); |
|
||||||
NativeBuffer keyBuffer = NativeBuffer.create(key); |
|
||||||
try { |
|
||||||
NativeBuffer valueBuffer = NativeBuffer.create(value); |
|
||||||
try { |
|
||||||
put(keyBuffer, valueBuffer); |
|
||||||
} finally { |
|
||||||
valueBuffer.delete(); |
|
||||||
} |
|
||||||
} finally { |
|
||||||
keyBuffer.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void put(NativeBuffer keyBuffer, NativeBuffer valueBuffer) { |
|
||||||
put(new NativeSlice(keyBuffer), new NativeSlice(valueBuffer)); |
|
||||||
} |
|
||||||
|
|
||||||
private void put(NativeSlice keySlice, NativeSlice valueSlice) { |
|
||||||
assertAllocated(); |
|
||||||
WriteBatchJNI.Put(self, keySlice, valueSlice); |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
public void delete(byte[] key) { |
|
||||||
NativeDB.checkArgNotNull(key, "key"); |
|
||||||
NativeBuffer keyBuffer = NativeBuffer.create(key); |
|
||||||
try { |
|
||||||
delete(keyBuffer); |
|
||||||
} finally { |
|
||||||
keyBuffer.delete(); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
private void delete(NativeBuffer keyBuffer) { |
|
||||||
delete(new NativeSlice(keyBuffer)); |
|
||||||
} |
|
||||||
|
|
||||||
private void delete(NativeSlice keySlice) { |
|
||||||
assertAllocated(); |
|
||||||
WriteBatchJNI.Delete(self, keySlice); |
|
||||||
} |
|
||||||
|
|
||||||
public void clear() { |
|
||||||
assertAllocated(); |
|
||||||
WriteBatchJNI.Clear(self); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,60 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.JniClass; |
|
||||||
import org.fusesource.hawtjni.runtime.JniField; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; |
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.STRUCT; |
|
||||||
|
|
||||||
/** |
|
||||||
* Provides a java interface to the C++ rocksdb::WriteOptions class. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
@JniClass(name="rocksdb::WriteOptions", flags={STRUCT, CPP}) |
|
||||||
public class NativeWriteOptions { |
|
||||||
|
|
||||||
@JniField |
|
||||||
boolean sync; |
|
||||||
|
|
||||||
public boolean sync() { |
|
||||||
return sync; |
|
||||||
} |
|
||||||
|
|
||||||
public NativeWriteOptions sync(boolean sync) { |
|
||||||
this.sync = sync; |
|
||||||
return this; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,141 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.internal; |
|
||||||
|
|
||||||
import org.fusesource.hawtjni.runtime.JniArg; |
|
||||||
import org.fusesource.hawtjni.runtime.JniClass; |
|
||||||
import org.fusesource.hawtjni.runtime.JniField; |
|
||||||
import org.fusesource.hawtjni.runtime.JniMethod; |
|
||||||
|
|
||||||
import java.io.File; |
|
||||||
import java.io.IOException; |
|
||||||
|
|
||||||
import static org.fusesource.hawtjni.runtime.ClassFlag.CPP; |
|
||||||
import static org.fusesource.hawtjni.runtime.FieldFlag.CONSTANT; |
|
||||||
import static org.fusesource.hawtjni.runtime.MethodFlag.*; |
|
||||||
import static org.fusesource.hawtjni.runtime.ArgFlag.*; |
|
||||||
|
|
||||||
/** |
|
||||||
* Some miscellaneous utility functions. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class Util { |
|
||||||
|
|
||||||
@JniClass(name="rocksdb::Env", flags={CPP}) |
|
||||||
static class EnvJNI { |
|
||||||
|
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
} |
|
||||||
|
|
||||||
@JniMethod(cast = "rocksdb::Env *", accessor = "rocksdb::Env::Default") |
|
||||||
public static final native long Default(); |
|
||||||
|
|
||||||
@JniMethod(flags = {CPP_METHOD}) |
|
||||||
public static final native void Schedule( |
|
||||||
long self, |
|
||||||
@JniArg(cast = "void (*)(void*)") long fp, |
|
||||||
@JniArg(cast = "void *") long arg); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@JniClass(flags={CPP}) |
|
||||||
static class UtilJNI { |
|
||||||
|
|
||||||
static { |
|
||||||
NativeDB.LIBRARY.load(); |
|
||||||
init(); |
|
||||||
} |
|
||||||
|
|
||||||
@JniMethod(flags={CONSTANT_INITIALIZER}) |
|
||||||
private static final native void init(); |
|
||||||
|
|
||||||
@JniField(flags={CONSTANT}, accessor="1", conditional="defined(_WIN32) || defined(_WIN64)") |
|
||||||
static int ON_WINDOWS; |
|
||||||
|
|
||||||
|
|
||||||
@JniMethod(conditional="!defined(_WIN32) && !defined(_WIN64)") |
|
||||||
static final native int link( |
|
||||||
@JniArg(cast="const char*") String source, |
|
||||||
@JniArg(cast="const char*") String target); |
|
||||||
|
|
||||||
@JniMethod(conditional="defined(_WIN32) || defined(_WIN64)") |
|
||||||
static final native int CreateHardLinkW( |
|
||||||
@JniArg(cast="LPCTSTR", flags={POINTER_ARG, UNICODE}) String target, |
|
||||||
@JniArg(cast="LPCTSTR", flags={POINTER_ARG, UNICODE}) String source, |
|
||||||
@JniArg(cast="LPSECURITY_ATTRIBUTES", flags={POINTER_ARG}) long lpSecurityAttributes); |
|
||||||
|
|
||||||
@JniMethod(flags={CONSTANT_GETTER}) |
|
||||||
public static final native int errno(); |
|
||||||
|
|
||||||
@JniMethod(cast="char *") |
|
||||||
public static final native long strerror(int errnum); |
|
||||||
|
|
||||||
public static final native int strlen( |
|
||||||
@JniArg(cast="const char *")long s); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
/** |
|
||||||
* Creates a hard link from source to target. |
|
||||||
* @param source |
|
||||||
* @param target |
|
||||||
* @return |
|
||||||
*/ |
|
||||||
public static void link(File source, File target) throws IOException { |
|
||||||
if( UtilJNI.ON_WINDOWS == 1 ) { |
|
||||||
if( UtilJNI.CreateHardLinkW(target.getCanonicalPath(), source.getCanonicalPath(), 0) == 0) { |
|
||||||
throw new IOException("link failed"); |
|
||||||
} |
|
||||||
} else { |
|
||||||
if( UtilJNI.link(source.getCanonicalPath(), target.getCanonicalPath()) != 0 ) { |
|
||||||
throw new IOException("link failed: "+strerror()); |
|
||||||
} |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
static int errno() { |
|
||||||
return UtilJNI.errno(); |
|
||||||
} |
|
||||||
|
|
||||||
static String strerror() { |
|
||||||
return string(UtilJNI.strerror(errno())); |
|
||||||
} |
|
||||||
|
|
||||||
static String string(long ptr) { |
|
||||||
if( ptr == 0 ) |
|
||||||
return null; |
|
||||||
return new String(new NativeSlice(ptr, UtilJNI.strlen(ptr)).toByteArray()); |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,28 +0,0 @@ |
|||||||
# ---------------------------------------------------------------------------
|
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
# contributor license agreements. See the NOTICE file distributed with
|
|
||||||
# this work for additional information regarding copyright ownership.
|
|
||||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
# (the "License"); you may not use this file except in compliance with
|
|
||||||
# the License. You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
|
||||||
|
|
||||||
lib_LTLIBRARIES = libleveldbjni.la
|
|
||||||
# libleveldbjni_la_CFLAGS =
|
|
||||||
#libleveldbjni_la_LDFLAGS =
|
|
||||||
|
|
||||||
libleveldbjni_la_SOURCES = src/leveldbjni.cpp\
|
|
||||||
src/leveldbjni_stats.cpp\
|
|
||||||
src/leveldbjni_structs.cpp\
|
|
||||||
src/buffer.c\
|
|
||||||
src/hawtjni.c
|
|
@ -1,810 +0,0 @@ |
|||||||
# Makefile.in generated by automake 1.12.1 from Makefile.am.
|
|
||||||
# @configure_input@
|
|
||||||
|
|
||||||
# Copyright (C) 1994-2012 Free Software Foundation, Inc.
|
|
||||||
|
|
||||||
# This Makefile.in is free software; the Free Software Foundation
|
|
||||||
# gives unlimited permission to copy and/or distribute it,
|
|
||||||
# with or without modifications, as long as this notice is preserved.
|
|
||||||
|
|
||||||
# This program is distributed in the hope that it will be useful,
|
|
||||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without
|
|
||||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A
|
|
||||||
# PARTICULAR PURPOSE.
|
|
||||||
|
|
||||||
@SET_MAKE@ |
|
||||||
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
# Licensed to the Apache Software Foundation (ASF) under one or more
|
|
||||||
# contributor license agreements. See the NOTICE file distributed with
|
|
||||||
# this work for additional information regarding copyright ownership.
|
|
||||||
# The ASF licenses this file to You under the Apache License, Version 2.0
|
|
||||||
# (the "License"); you may not use this file except in compliance with
|
|
||||||
# the License. You may obtain a copy of the License at
|
|
||||||
#
|
|
||||||
# http://www.apache.org/licenses/LICENSE-2.0
|
|
||||||
#
|
|
||||||
# Unless required by applicable law or agreed to in writing, software
|
|
||||||
# distributed under the License is distributed on an "AS IS" BASIS,
|
|
||||||
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
|
||||||
# See the License for the specific language governing permissions and
|
|
||||||
# limitations under the License.
|
|
||||||
# ---------------------------------------------------------------------------
|
|
||||||
|
|
||||||
VPATH = @srcdir@
|
|
||||||
am__make_dryrun = \
|
|
||||||
{ \
|
|
||||||
am__dry=no; \
|
|
||||||
case $$MAKEFLAGS in \
|
|
||||||
*\\[\ \ ]*) \
|
|
||||||
echo 'am--echo: ; @echo "AM" OK' | $(MAKE) -f - 2>/dev/null \
|
|
||||||
| grep '^AM OK$$' >/dev/null || am__dry=yes;; \
|
|
||||||
*) \
|
|
||||||
for am__flg in $$MAKEFLAGS; do \
|
|
||||||
case $$am__flg in \
|
|
||||||
*=*|--*) ;; \
|
|
||||||
*n*) am__dry=yes; break;; \
|
|
||||||
esac; \
|
|
||||||
done;; \
|
|
||||||
esac; \
|
|
||||||
test $$am__dry = yes; \
|
|
||||||
}
|
|
||||||
pkgdatadir = $(datadir)/@PACKAGE@
|
|
||||||
pkgincludedir = $(includedir)/@PACKAGE@
|
|
||||||
pkglibdir = $(libdir)/@PACKAGE@
|
|
||||||
pkglibexecdir = $(libexecdir)/@PACKAGE@
|
|
||||||
am__cd = CDPATH="$${ZSH_VERSION+.}$(PATH_SEPARATOR)" && cd
|
|
||||||
install_sh_DATA = $(install_sh) -c -m 644
|
|
||||||
install_sh_PROGRAM = $(install_sh) -c
|
|
||||||
install_sh_SCRIPT = $(install_sh) -c
|
|
||||||
INSTALL_HEADER = $(INSTALL_DATA)
|
|
||||||
transform = $(program_transform_name)
|
|
||||||
NORMAL_INSTALL = :
|
|
||||||
PRE_INSTALL = :
|
|
||||||
POST_INSTALL = :
|
|
||||||
NORMAL_UNINSTALL = :
|
|
||||||
PRE_UNINSTALL = :
|
|
||||||
POST_UNINSTALL = :
|
|
||||||
build_triplet = @build@
|
|
||||||
host_triplet = @host@
|
|
||||||
target_triplet = @target@
|
|
||||||
subdir = .
|
|
||||||
DIST_COMMON = $(am__configure_deps) $(srcdir)/Makefile.am \
|
|
||||||
$(srcdir)/Makefile.in $(top_srcdir)/autotools/ar-lib \
|
|
||||||
$(top_srcdir)/autotools/config.guess \
|
|
||||||
$(top_srcdir)/autotools/config.sub \
|
|
||||||
$(top_srcdir)/autotools/install-sh \
|
|
||||||
$(top_srcdir)/autotools/ltmain.sh \
|
|
||||||
$(top_srcdir)/autotools/missing $(top_srcdir)/configure \
|
|
||||||
$(top_srcdir)/src/config.h.in autotools/ar-lib \
|
|
||||||
autotools/config.guess autotools/config.sub \
|
|
||||||
autotools/install-sh autotools/ltmain.sh autotools/missing
|
|
||||||
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
|
|
||||||
am__aclocal_m4_deps = $(top_srcdir)/m4/custom.m4 \
|
|
||||||
$(top_srcdir)/m4/jni.m4 $(top_srcdir)/m4/libtool.m4 \
|
|
||||||
$(top_srcdir)/m4/ltoptions.m4 $(top_srcdir)/m4/ltsugar.m4 \
|
|
||||||
$(top_srcdir)/m4/ltversion.m4 $(top_srcdir)/m4/lt~obsolete.m4 \
|
|
||||||
$(top_srcdir)/m4/osx-universal.m4 $(top_srcdir)/configure.ac
|
|
||||||
am__configure_deps = $(am__aclocal_m4_deps) $(CONFIGURE_DEPENDENCIES) \
|
|
||||||
$(ACLOCAL_M4)
|
|
||||||
am__CONFIG_DISTCLEAN_FILES = config.status config.cache config.log \
|
|
||||||
configure.lineno config.status.lineno
|
|
||||||
mkinstalldirs = $(install_sh) -d
|
|
||||||
CONFIG_HEADER = $(top_builddir)/src/config.h
|
|
||||||
CONFIG_CLEAN_FILES =
|
|
||||||
CONFIG_CLEAN_VPATH_FILES =
|
|
||||||
am__vpath_adj_setup = srcdirstrip=`echo "$(srcdir)" | sed 's|.|.|g'`;
|
|
||||||
am__vpath_adj = case $$p in \
|
|
||||||
$(srcdir)/*) f=`echo "$$p" | sed "s|^$$srcdirstrip/||"`;; \
|
|
||||||
*) f=$$p;; \
|
|
||||||
esac;
|
|
||||||
am__strip_dir = f=`echo $$p | sed -e 's|^.*/||'`;
|
|
||||||
am__install_max = 40
|
|
||||||
am__nobase_strip_setup = \
|
|
||||||
srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*|]/\\\\&/g'`
|
|
||||||
am__nobase_strip = \
|
|
||||||
for p in $$list; do echo "$$p"; done | sed -e "s|$$srcdirstrip/||"
|
|
||||||
am__nobase_list = $(am__nobase_strip_setup); \
|
|
||||||
for p in $$list; do echo "$$p $$p"; done | \
|
|
||||||
sed "s| $$srcdirstrip/| |;"' / .*\//!s/ .*/ ./; s,\( .*\)/[^/]*$$,\1,' | \
|
|
||||||
$(AWK) 'BEGIN { files["."] = "" } { files[$$2] = files[$$2] " " $$1; \
|
|
||||||
if (++n[$$2] == $(am__install_max)) \
|
|
||||||
{ print $$2, files[$$2]; n[$$2] = 0; files[$$2] = "" } } \
|
|
||||||
END { for (dir in files) print dir, files[dir] }'
|
|
||||||
am__base_list = \
|
|
||||||
sed '$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;$$!N;s/\n/ /g' | \
|
|
||||||
sed '$$!N;$$!N;$$!N;$$!N;s/\n/ /g'
|
|
||||||
am__uninstall_files_from_dir = { \
|
|
||||||
test -z "$$files" \
|
|
||||||
|| { test ! -d "$$dir" && test ! -f "$$dir" && test ! -r "$$dir"; } \
|
|
||||||
|| { echo " ( cd '$$dir' && rm -f" $$files ")"; \
|
|
||||||
$(am__cd) "$$dir" && rm -f $$files; }; \
|
|
||||||
}
|
|
||||||
am__installdirs = "$(DESTDIR)$(libdir)"
|
|
||||||
LTLIBRARIES = $(lib_LTLIBRARIES)
|
|
||||||
libleveldbjni_la_LIBADD =
|
|
||||||
am_libleveldbjni_la_OBJECTS = leveldbjni.lo leveldbjni_stats.lo \
|
|
||||||
leveldbjni_structs.lo buffer.lo hawtjni.lo
|
|
||||||
libleveldbjni_la_OBJECTS = $(am_libleveldbjni_la_OBJECTS)
|
|
||||||
DEFAULT_INCLUDES = -I.@am__isrc@ -I$(top_builddir)/src
|
|
||||||
depcomp =
|
|
||||||
am__depfiles_maybe =
|
|
||||||
COMPILE = $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) \
|
|
||||||
$(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
|
||||||
LTCOMPILE = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
|
||||||
--mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
|
||||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS)
|
|
||||||
CCLD = $(CC)
|
|
||||||
LINK = $(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
|
||||||
--mode=link $(CCLD) $(AM_CFLAGS) $(CFLAGS) $(AM_LDFLAGS) \
|
|
||||||
$(LDFLAGS) -o $@
|
|
||||||
CXXCOMPILE = $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
|
||||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
|
||||||
LTCXXCOMPILE = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
|
||||||
--mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) \
|
|
||||||
$(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS)
|
|
||||||
CXXLD = $(CXX)
|
|
||||||
CXXLINK = $(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) \
|
|
||||||
--mode=link $(CXXLD) $(AM_CXXFLAGS) $(CXXFLAGS) $(AM_LDFLAGS) \
|
|
||||||
$(LDFLAGS) -o $@
|
|
||||||
SOURCES = $(libleveldbjni_la_SOURCES)
|
|
||||||
DIST_SOURCES = $(libleveldbjni_la_SOURCES)
|
|
||||||
am__can_run_installinfo = \
|
|
||||||
case $$AM_UPDATE_INFO_DIR in \
|
|
||||||
n|no|NO) false;; \
|
|
||||||
*) (install-info --version) >/dev/null 2>&1;; \
|
|
||||||
esac
|
|
||||||
ETAGS = etags
|
|
||||||
CTAGS = ctags
|
|
||||||
CSCOPE = cscope
|
|
||||||
AM_RECURSIVE_TARGETS = cscope
|
|
||||||
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
|
|
||||||
distdir = $(PACKAGE)-$(VERSION)
|
|
||||||
top_distdir = $(distdir)
|
|
||||||
am__remove_distdir = \
|
|
||||||
if test -d "$(distdir)"; then \
|
|
||||||
find "$(distdir)" -type d ! -perm -200 -exec chmod u+w {} ';' \
|
|
||||||
&& rm -rf "$(distdir)" \
|
|
||||||
|| { sleep 5 && rm -rf "$(distdir)"; }; \
|
|
||||||
else :; fi
|
|
||||||
am__post_remove_distdir = $(am__remove_distdir)
|
|
||||||
DIST_ARCHIVES = $(distdir).tar.gz
|
|
||||||
GZIP_ENV = --best
|
|
||||||
DIST_TARGETS = dist-gzip
|
|
||||||
distuninstallcheck_listfiles = find . -type f -print
|
|
||||||
am__distuninstallcheck_listfiles = $(distuninstallcheck_listfiles) \
|
|
||||||
| sed 's|^\./|$(prefix)/|' | grep -v '$(infodir)/dir$$'
|
|
||||||
distcleancheck_listfiles = find . -type f -print
|
|
||||||
ACLOCAL = @ACLOCAL@
|
|
||||||
AMTAR = @AMTAR@
|
|
||||||
AR = @AR@
|
|
||||||
AUTOCONF = @AUTOCONF@
|
|
||||||
AUTOHEADER = @AUTOHEADER@
|
|
||||||
AUTOMAKE = @AUTOMAKE@
|
|
||||||
AWK = @AWK@
|
|
||||||
CC = @CC@
|
|
||||||
CFLAGS = @CFLAGS@
|
|
||||||
CPP = @CPP@
|
|
||||||
CPPFLAGS = @CPPFLAGS@
|
|
||||||
CXX = @CXX@
|
|
||||||
CXXCPP = @CXXCPP@
|
|
||||||
CXXFLAGS = @CXXFLAGS@
|
|
||||||
CYGPATH_W = @CYGPATH_W@
|
|
||||||
DEFS = @DEFS@
|
|
||||||
DLLTOOL = @DLLTOOL@
|
|
||||||
DSYMUTIL = @DSYMUTIL@
|
|
||||||
DUMPBIN = @DUMPBIN@
|
|
||||||
ECHO_C = @ECHO_C@
|
|
||||||
ECHO_N = @ECHO_N@
|
|
||||||
ECHO_T = @ECHO_T@
|
|
||||||
EGREP = @EGREP@
|
|
||||||
EXEEXT = @EXEEXT@
|
|
||||||
FGREP = @FGREP@
|
|
||||||
GREP = @GREP@
|
|
||||||
INSTALL = @INSTALL@
|
|
||||||
INSTALL_DATA = @INSTALL_DATA@
|
|
||||||
INSTALL_PROGRAM = @INSTALL_PROGRAM@
|
|
||||||
INSTALL_SCRIPT = @INSTALL_SCRIPT@
|
|
||||||
INSTALL_STRIP_PROGRAM = @INSTALL_STRIP_PROGRAM@
|
|
||||||
JNI_EXTRA_CFLAGS = @JNI_EXTRA_CFLAGS@
|
|
||||||
JNI_EXTRA_LDFLAGS = @JNI_EXTRA_LDFLAGS@
|
|
||||||
JNI_JDK = @JNI_JDK@
|
|
||||||
LD = @LD@
|
|
||||||
LDFLAGS = @LDFLAGS@
|
|
||||||
LIBOBJS = @LIBOBJS@
|
|
||||||
LIBS = @LIBS@
|
|
||||||
LIBTOOL = @LIBTOOL@
|
|
||||||
LIPO = @LIPO@
|
|
||||||
LN_S = @LN_S@
|
|
||||||
LTLIBOBJS = @LTLIBOBJS@
|
|
||||||
MAKEINFO = @MAKEINFO@
|
|
||||||
MANIFEST_TOOL = @MANIFEST_TOOL@
|
|
||||||
MKDIR_P = @MKDIR_P@
|
|
||||||
NM = @NM@
|
|
||||||
NMEDIT = @NMEDIT@
|
|
||||||
OBJDUMP = @OBJDUMP@
|
|
||||||
OBJEXT = @OBJEXT@
|
|
||||||
OSX_SDKS_DIR = @OSX_SDKS_DIR@
|
|
||||||
OSX_VERSION = @OSX_VERSION@
|
|
||||||
OTOOL = @OTOOL@
|
|
||||||
OTOOL64 = @OTOOL64@
|
|
||||||
PACKAGE = @PACKAGE@
|
|
||||||
PACKAGE_BUGREPORT = @PACKAGE_BUGREPORT@
|
|
||||||
PACKAGE_NAME = @PACKAGE_NAME@
|
|
||||||
PACKAGE_STRING = @PACKAGE_STRING@
|
|
||||||
PACKAGE_TARNAME = @PACKAGE_TARNAME@
|
|
||||||
PACKAGE_URL = @PACKAGE_URL@
|
|
||||||
PACKAGE_VERSION = @PACKAGE_VERSION@
|
|
||||||
PATH_SEPARATOR = @PATH_SEPARATOR@
|
|
||||||
RANLIB = @RANLIB@
|
|
||||||
SED = @SED@
|
|
||||||
SET_MAKE = @SET_MAKE@
|
|
||||||
SHELL = @SHELL@
|
|
||||||
STRIP = @STRIP@
|
|
||||||
VERSION = @VERSION@
|
|
||||||
abs_builddir = @abs_builddir@
|
|
||||||
abs_srcdir = @abs_srcdir@
|
|
||||||
abs_top_builddir = @abs_top_builddir@
|
|
||||||
abs_top_srcdir = @abs_top_srcdir@
|
|
||||||
ac_ct_AR = @ac_ct_AR@
|
|
||||||
ac_ct_CC = @ac_ct_CC@
|
|
||||||
ac_ct_CXX = @ac_ct_CXX@
|
|
||||||
ac_ct_DUMPBIN = @ac_ct_DUMPBIN@
|
|
||||||
am__leading_dot = @am__leading_dot@
|
|
||||||
am__tar = @am__tar@
|
|
||||||
am__untar = @am__untar@
|
|
||||||
bindir = @bindir@
|
|
||||||
build = @build@
|
|
||||||
build_alias = @build_alias@
|
|
||||||
build_cpu = @build_cpu@
|
|
||||||
build_os = @build_os@
|
|
||||||
build_vendor = @build_vendor@
|
|
||||||
builddir = @builddir@
|
|
||||||
datadir = @datadir@
|
|
||||||
datarootdir = @datarootdir@
|
|
||||||
docdir = @docdir@
|
|
||||||
dvidir = @dvidir@
|
|
||||||
exec_prefix = @exec_prefix@
|
|
||||||
host = @host@
|
|
||||||
host_alias = @host_alias@
|
|
||||||
host_cpu = @host_cpu@
|
|
||||||
host_os = @host_os@
|
|
||||||
host_vendor = @host_vendor@
|
|
||||||
htmldir = @htmldir@
|
|
||||||
includedir = @includedir@
|
|
||||||
infodir = @infodir@
|
|
||||||
install_sh = @install_sh@
|
|
||||||
libdir = @libdir@
|
|
||||||
libexecdir = @libexecdir@
|
|
||||||
localedir = @localedir@
|
|
||||||
localstatedir = @localstatedir@
|
|
||||||
mandir = @mandir@
|
|
||||||
oldincludedir = @oldincludedir@
|
|
||||||
pdfdir = @pdfdir@
|
|
||||||
prefix = @prefix@
|
|
||||||
program_transform_name = @program_transform_name@
|
|
||||||
psdir = @psdir@
|
|
||||||
sbindir = @sbindir@
|
|
||||||
sharedstatedir = @sharedstatedir@
|
|
||||||
srcdir = @srcdir@
|
|
||||||
sysconfdir = @sysconfdir@
|
|
||||||
target = @target@
|
|
||||||
target_alias = @target_alias@
|
|
||||||
target_cpu = @target_cpu@
|
|
||||||
target_os = @target_os@
|
|
||||||
target_vendor = @target_vendor@
|
|
||||||
top_build_prefix = @top_build_prefix@
|
|
||||||
top_builddir = @top_builddir@
|
|
||||||
top_srcdir = @top_srcdir@
|
|
||||||
ACLOCAL_AMFLAGS = -I m4
|
|
||||||
lib_LTLIBRARIES = libleveldbjni.la
|
|
||||||
# libleveldbjni_la_CFLAGS =
|
|
||||||
#libleveldbjni_la_LDFLAGS =
|
|
||||||
libleveldbjni_la_SOURCES = src/leveldbjni.cpp\
|
|
||||||
src/leveldbjni_stats.cpp\
|
|
||||||
src/leveldbjni_structs.cpp\
|
|
||||||
src/buffer.c\
|
|
||||||
src/hawtjni.c
|
|
||||||
|
|
||||||
all: all-am |
|
||||||
|
|
||||||
.SUFFIXES: |
|
||||||
.SUFFIXES: .c .cpp .lo .o .obj |
|
||||||
am--refresh: Makefile |
|
||||||
@:
|
|
||||||
$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps) |
|
||||||
@for dep in $?; do \
|
|
||||||
case '$(am__configure_deps)' in \
|
|
||||||
*$$dep*) \
|
|
||||||
echo ' cd $(srcdir) && $(AUTOMAKE) --foreign --ignore-deps'; \
|
|
||||||
$(am__cd) $(srcdir) && $(AUTOMAKE) --foreign --ignore-deps \
|
|
||||||
&& exit 0; \
|
|
||||||
exit 1;; \
|
|
||||||
esac; \
|
|
||||||
done; \
|
|
||||||
echo ' cd $(top_srcdir) && $(AUTOMAKE) --foreign --ignore-deps Makefile'; \
|
|
||||||
$(am__cd) $(top_srcdir) && \
|
|
||||||
$(AUTOMAKE) --foreign --ignore-deps Makefile
|
|
||||||
.PRECIOUS: Makefile |
|
||||||
Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status |
|
||||||
@case '$?' in \
|
|
||||||
*config.status*) \
|
|
||||||
echo ' $(SHELL) ./config.status'; \
|
|
||||||
$(SHELL) ./config.status;; \
|
|
||||||
*) \
|
|
||||||
echo ' cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe)'; \
|
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status $@ $(am__depfiles_maybe);; \
|
|
||||||
esac;
|
|
||||||
|
|
||||||
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES) |
|
||||||
$(SHELL) ./config.status --recheck
|
|
||||||
|
|
||||||
$(top_srcdir)/configure: $(am__configure_deps) |
|
||||||
$(am__cd) $(srcdir) && $(AUTOCONF)
|
|
||||||
$(ACLOCAL_M4): $(am__aclocal_m4_deps) |
|
||||||
$(am__cd) $(srcdir) && $(ACLOCAL) $(ACLOCAL_AMFLAGS)
|
|
||||||
$(am__aclocal_m4_deps): |
|
||||||
|
|
||||||
src/config.h: src/stamp-h1 |
|
||||||
@if test ! -f $@; then rm -f src/stamp-h1; else :; fi
|
|
||||||
@if test ! -f $@; then $(MAKE) $(AM_MAKEFLAGS) src/stamp-h1; else :; fi
|
|
||||||
|
|
||||||
src/stamp-h1: $(top_srcdir)/src/config.h.in $(top_builddir)/config.status |
|
||||||
@rm -f src/stamp-h1
|
|
||||||
cd $(top_builddir) && $(SHELL) ./config.status src/config.h
|
|
||||||
$(top_srcdir)/src/config.h.in: $(am__configure_deps) |
|
||||||
($(am__cd) $(top_srcdir) && $(AUTOHEADER))
|
|
||||||
rm -f src/stamp-h1
|
|
||||||
touch $@
|
|
||||||
|
|
||||||
distclean-hdr: |
|
||||||
-rm -f src/config.h src/stamp-h1
|
|
||||||
install-libLTLIBRARIES: $(lib_LTLIBRARIES) |
|
||||||
@$(NORMAL_INSTALL)
|
|
||||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
|
||||||
list2=; for p in $$list; do \
|
|
||||||
if test -f $$p; then \
|
|
||||||
list2="$$list2 $$p"; \
|
|
||||||
else :; fi; \
|
|
||||||
done; \
|
|
||||||
test -z "$$list2" || { \
|
|
||||||
echo " $(MKDIR_P) '$(DESTDIR)$(libdir)'"; \
|
|
||||||
$(MKDIR_P) "$(DESTDIR)$(libdir)" || exit 1; \
|
|
||||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 '$(DESTDIR)$(libdir)'"; \
|
|
||||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=install $(INSTALL) $(INSTALL_STRIP_FLAG) $$list2 "$(DESTDIR)$(libdir)"; \
|
|
||||||
}
|
|
||||||
|
|
||||||
uninstall-libLTLIBRARIES: |
|
||||||
@$(NORMAL_UNINSTALL)
|
|
||||||
@list='$(lib_LTLIBRARIES)'; test -n "$(libdir)" || list=; \
|
|
||||||
for p in $$list; do \
|
|
||||||
$(am__strip_dir) \
|
|
||||||
echo " $(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f '$(DESTDIR)$(libdir)/$$f'"; \
|
|
||||||
$(LIBTOOL) $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=uninstall rm -f "$(DESTDIR)$(libdir)/$$f"; \
|
|
||||||
done
|
|
||||||
|
|
||||||
clean-libLTLIBRARIES: |
|
||||||
-test -z "$(lib_LTLIBRARIES)" || rm -f $(lib_LTLIBRARIES)
|
|
||||||
@list='$(lib_LTLIBRARIES)'; \
|
|
||||||
locs=`for p in $$list; do echo $$p; done | \
|
|
||||||
sed 's|^[^/]*$$|.|; s|/[^/]*$$||; s|$$|/so_locations|' | \
|
|
||||||
sort -u`; \
|
|
||||||
test -z "$$locs" || { \
|
|
||||||
echo rm -f $${locs}; \
|
|
||||||
rm -f $${locs}; \
|
|
||||||
}
|
|
||||||
libleveldbjni.la: $(libleveldbjni_la_OBJECTS) $(libleveldbjni_la_DEPENDENCIES) $(EXTRA_libleveldbjni_la_DEPENDENCIES) |
|
||||||
$(CXXLINK) -rpath $(libdir) $(libleveldbjni_la_OBJECTS) $(libleveldbjni_la_LIBADD) $(LIBS)
|
|
||||||
|
|
||||||
mostlyclean-compile: |
|
||||||
-rm -f *.$(OBJEXT)
|
|
||||||
|
|
||||||
distclean-compile: |
|
||||||
-rm -f *.tab.c
|
|
||||||
|
|
||||||
.c.o: |
|
||||||
$(COMPILE) -c $<
|
|
||||||
|
|
||||||
.c.obj: |
|
||||||
$(COMPILE) -c `$(CYGPATH_W) '$<'`
|
|
||||||
|
|
||||||
.c.lo: |
|
||||||
$(LTCOMPILE) -c -o $@ $<
|
|
||||||
|
|
||||||
buffer.lo: src/buffer.c |
|
||||||
$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o buffer.lo `test -f 'src/buffer.c' || echo '$(srcdir)/'`src/buffer.c
|
|
||||||
|
|
||||||
hawtjni.lo: src/hawtjni.c |
|
||||||
$(LIBTOOL) --tag=CC $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CC) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CFLAGS) $(CFLAGS) -c -o hawtjni.lo `test -f 'src/hawtjni.c' || echo '$(srcdir)/'`src/hawtjni.c
|
|
||||||
|
|
||||||
.cpp.o: |
|
||||||
$(CXXCOMPILE) -c -o $@ $<
|
|
||||||
|
|
||||||
.cpp.obj: |
|
||||||
$(CXXCOMPILE) -c -o $@ `$(CYGPATH_W) '$<'`
|
|
||||||
|
|
||||||
.cpp.lo: |
|
||||||
$(LTCXXCOMPILE) -c -o $@ $<
|
|
||||||
|
|
||||||
leveldbjni.lo: src/leveldbjni.cpp |
|
||||||
$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o leveldbjni.lo `test -f 'src/leveldbjni.cpp' || echo '$(srcdir)/'`src/leveldbjni.cpp
|
|
||||||
|
|
||||||
leveldbjni_stats.lo: src/leveldbjni_stats.cpp |
|
||||||
$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o leveldbjni_stats.lo `test -f 'src/leveldbjni_stats.cpp' || echo '$(srcdir)/'`src/leveldbjni_stats.cpp
|
|
||||||
|
|
||||||
leveldbjni_structs.lo: src/leveldbjni_structs.cpp |
|
||||||
$(LIBTOOL) --tag=CXX $(AM_LIBTOOLFLAGS) $(LIBTOOLFLAGS) --mode=compile $(CXX) $(DEFS) $(DEFAULT_INCLUDES) $(INCLUDES) $(AM_CPPFLAGS) $(CPPFLAGS) $(AM_CXXFLAGS) $(CXXFLAGS) -c -o leveldbjni_structs.lo `test -f 'src/leveldbjni_structs.cpp' || echo '$(srcdir)/'`src/leveldbjni_structs.cpp
|
|
||||||
|
|
||||||
mostlyclean-libtool: |
|
||||||
-rm -f *.lo
|
|
||||||
|
|
||||||
clean-libtool: |
|
||||||
-rm -rf .libs _libs
|
|
||||||
|
|
||||||
distclean-libtool: |
|
||||||
-rm -f libtool config.lt
|
|
||||||
|
|
||||||
ID: $(HEADERS) $(SOURCES) $(LISP) $(TAGS_FILES) |
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
|
||||||
unique=`for i in $$list; do \
|
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
|
||||||
done | \
|
|
||||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
|
||||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
|
||||||
mkid -fID $$unique
|
|
||||||
tags: TAGS |
|
||||||
|
|
||||||
TAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|
||||||
$(TAGS_FILES) $(LISP)
|
|
||||||
set x; \
|
|
||||||
here=`pwd`; \
|
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
|
||||||
unique=`for i in $$list; do \
|
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
|
||||||
done | \
|
|
||||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
|
||||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
|
||||||
shift; \
|
|
||||||
if test -z "$(ETAGS_ARGS)$$*$$unique"; then :; else \
|
|
||||||
test -n "$$unique" || unique=$$empty_fix; \
|
|
||||||
if test $$# -gt 0; then \
|
|
||||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
|
||||||
"$$@" $$unique; \
|
|
||||||
else \
|
|
||||||
$(ETAGS) $(ETAGSFLAGS) $(AM_ETAGSFLAGS) $(ETAGS_ARGS) \
|
|
||||||
$$unique; \
|
|
||||||
fi; \
|
|
||||||
fi
|
|
||||||
ctags: CTAGS |
|
||||||
CTAGS: $(HEADERS) $(SOURCES) $(TAGS_DEPENDENCIES) \
|
|
||||||
$(TAGS_FILES) $(LISP)
|
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP) $(TAGS_FILES)'; \
|
|
||||||
unique=`for i in $$list; do \
|
|
||||||
if test -f "$$i"; then echo $$i; else echo $(srcdir)/$$i; fi; \
|
|
||||||
done | \
|
|
||||||
$(AWK) '{ files[$$0] = 1; nonempty = 1; } \
|
|
||||||
END { if (nonempty) { for (i in files) print i; }; }'`; \
|
|
||||||
test -z "$(CTAGS_ARGS)$$unique" \
|
|
||||||
|| $(CTAGS) $(CTAGSFLAGS) $(AM_CTAGSFLAGS) $(CTAGS_ARGS) \
|
|
||||||
$$unique
|
|
||||||
|
|
||||||
GTAGS: |
|
||||||
here=`$(am__cd) $(top_builddir) && pwd` \
|
|
||||||
&& $(am__cd) $(top_srcdir) \
|
|
||||||
&& gtags -i $(GTAGS_ARGS) "$$here"
|
|
||||||
|
|
||||||
cscope: cscope.files |
|
||||||
test ! -s cscope.files \
|
|
||||||
|| $(CSCOPE) -b -q $(AM_CSCOPEFLAGS) $(CSCOPEFLAGS) -i cscope.files $(CSCOPE_ARGS)
|
|
||||||
|
|
||||||
clean-cscope: |
|
||||||
-rm -f cscope.files
|
|
||||||
|
|
||||||
cscope.files: clean-cscope cscopelist |
|
||||||
|
|
||||||
cscopelist: $(HEADERS) $(SOURCES) $(LISP) |
|
||||||
list='$(SOURCES) $(HEADERS) $(LISP)'; \
|
|
||||||
case "$(srcdir)" in \
|
|
||||||
[\\/]* | ?:[\\/]*) sdir="$(srcdir)" ;; \
|
|
||||||
*) sdir=$(subdir)/$(srcdir) ;; \
|
|
||||||
esac; \
|
|
||||||
for i in $$list; do \
|
|
||||||
if test -f "$$i"; then \
|
|
||||||
echo "$(subdir)/$$i"; \
|
|
||||||
else \
|
|
||||||
echo "$$sdir/$$i"; \
|
|
||||||
fi; \
|
|
||||||
done >> $(top_builddir)/cscope.files
|
|
||||||
|
|
||||||
distclean-tags: |
|
||||||
-rm -f TAGS ID GTAGS GRTAGS GSYMS GPATH tags
|
|
||||||
-rm -f cscope.out cscope.in.out cscope.po.out cscope.files
|
|
||||||
|
|
||||||
distdir: $(DISTFILES) |
|
||||||
$(am__remove_distdir)
|
|
||||||
test -d "$(distdir)" || mkdir "$(distdir)"
|
|
||||||
@srcdirstrip=`echo "$(srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
|
||||||
topsrcdirstrip=`echo "$(top_srcdir)" | sed 's/[].[^$$\\*]/\\\\&/g'`; \
|
|
||||||
list='$(DISTFILES)'; \
|
|
||||||
dist_files=`for file in $$list; do echo $$file; done | \
|
|
||||||
sed -e "s|^$$srcdirstrip/||;t" \
|
|
||||||
-e "s|^$$topsrcdirstrip/|$(top_builddir)/|;t"`; \
|
|
||||||
case $$dist_files in \
|
|
||||||
*/*) $(MKDIR_P) `echo "$$dist_files" | \
|
|
||||||
sed '/\//!d;s|^|$(distdir)/|;s,/[^/]*$$,,' | \
|
|
||||||
sort -u` ;; \
|
|
||||||
esac; \
|
|
||||||
for file in $$dist_files; do \
|
|
||||||
if test -f $$file || test -d $$file; then d=.; else d=$(srcdir); fi; \
|
|
||||||
if test -d $$d/$$file; then \
|
|
||||||
dir=`echo "/$$file" | sed -e 's,/[^/]*$$,,'`; \
|
|
||||||
if test -d "$(distdir)/$$file"; then \
|
|
||||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
|
||||||
fi; \
|
|
||||||
if test -d $(srcdir)/$$file && test $$d != $(srcdir); then \
|
|
||||||
cp -fpR $(srcdir)/$$file "$(distdir)$$dir" || exit 1; \
|
|
||||||
find "$(distdir)/$$file" -type d ! -perm -700 -exec chmod u+rwx {} \;; \
|
|
||||||
fi; \
|
|
||||||
cp -fpR $$d/$$file "$(distdir)$$dir" || exit 1; \
|
|
||||||
else \
|
|
||||||
test -f "$(distdir)/$$file" \
|
|
||||||
|| cp -p $$d/$$file "$(distdir)/$$file" \
|
|
||||||
|| exit 1; \
|
|
||||||
fi; \
|
|
||||||
done
|
|
||||||
-test -n "$(am__skip_mode_fix)" \
|
|
||||||
|| find "$(distdir)" -type d ! -perm -755 \
|
|
||||||
-exec chmod u+rwx,go+rx {} \; -o \
|
|
||||||
! -type d ! -perm -444 -links 1 -exec chmod a+r {} \; -o \
|
|
||||||
! -type d ! -perm -400 -exec chmod a+r {} \; -o \
|
|
||||||
! -type d ! -perm -444 -exec $(install_sh) -c -m a+r {} {} \; \
|
|
||||||
|| chmod -R a+r "$(distdir)"
|
|
||||||
dist-gzip: distdir |
|
||||||
tardir=$(distdir) && $(am__tar) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).tar.gz
|
|
||||||
$(am__post_remove_distdir)
|
|
||||||
|
|
||||||
dist-bzip2: distdir |
|
||||||
tardir=$(distdir) && $(am__tar) | BZIP2=$${BZIP2--9} bzip2 -c >$(distdir).tar.bz2
|
|
||||||
$(am__post_remove_distdir)
|
|
||||||
|
|
||||||
dist-lzip: distdir |
|
||||||
tardir=$(distdir) && $(am__tar) | lzip -c $${LZIP_OPT--9} >$(distdir).tar.lz
|
|
||||||
$(am__post_remove_distdir)
|
|
||||||
|
|
||||||
dist-xz: distdir |
|
||||||
tardir=$(distdir) && $(am__tar) | XZ_OPT=$${XZ_OPT--e} xz -c >$(distdir).tar.xz
|
|
||||||
$(am__post_remove_distdir)
|
|
||||||
|
|
||||||
dist-tarZ: distdir |
|
||||||
tardir=$(distdir) && $(am__tar) | compress -c >$(distdir).tar.Z
|
|
||||||
$(am__post_remove_distdir)
|
|
||||||
|
|
||||||
dist-shar: distdir |
|
||||||
shar $(distdir) | GZIP=$(GZIP_ENV) gzip -c >$(distdir).shar.gz
|
|
||||||
$(am__post_remove_distdir)
|
|
||||||
|
|
||||||
dist-zip: distdir |
|
||||||
-rm -f $(distdir).zip
|
|
||||||
zip -rq $(distdir).zip $(distdir)
|
|
||||||
$(am__post_remove_distdir)
|
|
||||||
|
|
||||||
dist dist-all: |
|
||||||
$(MAKE) $(AM_MAKEFLAGS) $(DIST_TARGETS) am__post_remove_distdir='@:'
|
|
||||||
$(am__post_remove_distdir)
|
|
||||||
|
|
||||||
# This target untars the dist file and tries a VPATH configuration. Then
|
|
||||||
# it guarantees that the distribution is self-contained by making another
|
|
||||||
# tarfile.
|
|
||||||
distcheck: dist |
|
||||||
case '$(DIST_ARCHIVES)' in \
|
|
||||||
*.tar.gz*) \
|
|
||||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).tar.gz | $(am__untar) ;;\
|
|
||||||
*.tar.bz2*) \
|
|
||||||
bzip2 -dc $(distdir).tar.bz2 | $(am__untar) ;;\
|
|
||||||
*.tar.lz*) \
|
|
||||||
lzip -dc $(distdir).tar.lz | $(am__untar) ;;\
|
|
||||||
*.tar.xz*) \
|
|
||||||
xz -dc $(distdir).tar.xz | $(am__untar) ;;\
|
|
||||||
*.tar.Z*) \
|
|
||||||
uncompress -c $(distdir).tar.Z | $(am__untar) ;;\
|
|
||||||
*.shar.gz*) \
|
|
||||||
GZIP=$(GZIP_ENV) gzip -dc $(distdir).shar.gz | unshar ;;\
|
|
||||||
*.zip*) \
|
|
||||||
unzip $(distdir).zip ;;\
|
|
||||||
esac
|
|
||||||
chmod -R a-w $(distdir); chmod a+w $(distdir)
|
|
||||||
mkdir $(distdir)/_build
|
|
||||||
mkdir $(distdir)/_inst
|
|
||||||
chmod a-w $(distdir)
|
|
||||||
test -d $(distdir)/_build || exit 0; \
|
|
||||||
dc_install_base=`$(am__cd) $(distdir)/_inst && pwd | sed -e 's,^[^:\\/]:[\\/],/,'` \
|
|
||||||
&& dc_destdir="$${TMPDIR-/tmp}/am-dc-$$$$/" \
|
|
||||||
&& am__cwd=`pwd` \
|
|
||||||
&& $(am__cd) $(distdir)/_build \
|
|
||||||
&& ../configure --srcdir=.. --prefix="$$dc_install_base" \
|
|
||||||
$(AM_DISTCHECK_CONFIGURE_FLAGS) \
|
|
||||||
$(DISTCHECK_CONFIGURE_FLAGS) \
|
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) \
|
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) dvi \
|
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) check \
|
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) install \
|
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) installcheck \
|
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) uninstall \
|
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) distuninstallcheck_dir="$$dc_install_base" \
|
|
||||||
distuninstallcheck \
|
|
||||||
&& chmod -R a-w "$$dc_install_base" \
|
|
||||||
&& ({ \
|
|
||||||
(cd ../.. && umask 077 && mkdir "$$dc_destdir") \
|
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" install \
|
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" uninstall \
|
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) DESTDIR="$$dc_destdir" \
|
|
||||||
distuninstallcheck_dir="$$dc_destdir" distuninstallcheck; \
|
|
||||||
} || { rm -rf "$$dc_destdir"; exit 1; }) \
|
|
||||||
&& rm -rf "$$dc_destdir" \
|
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) dist \
|
|
||||||
&& rm -rf $(DIST_ARCHIVES) \
|
|
||||||
&& $(MAKE) $(AM_MAKEFLAGS) distcleancheck \
|
|
||||||
&& cd "$$am__cwd" \
|
|
||||||
|| exit 1
|
|
||||||
$(am__post_remove_distdir)
|
|
||||||
@(echo "$(distdir) archives ready for distribution: "; \
|
|
||||||
list='$(DIST_ARCHIVES)'; for i in $$list; do echo $$i; done) | \
|
|
||||||
sed -e 1h -e 1s/./=/g -e 1p -e 1x -e '$$p' -e '$$x'
|
|
||||||
distuninstallcheck: |
|
||||||
@test -n '$(distuninstallcheck_dir)' || { \
|
|
||||||
echo 'ERROR: trying to run $@ with an empty' \
|
|
||||||
'$$(distuninstallcheck_dir)' >&2; \
|
|
||||||
exit 1; \
|
|
||||||
}; \
|
|
||||||
$(am__cd) '$(distuninstallcheck_dir)' || { \
|
|
||||||
echo 'ERROR: cannot chdir into $(distuninstallcheck_dir)' >&2; \
|
|
||||||
exit 1; \
|
|
||||||
}; \
|
|
||||||
test `$(am__distuninstallcheck_listfiles) | wc -l` -eq 0 \
|
|
||||||
|| { echo "ERROR: files left after uninstall:" ; \
|
|
||||||
if test -n "$(DESTDIR)"; then \
|
|
||||||
echo " (check DESTDIR support)"; \
|
|
||||||
fi ; \
|
|
||||||
$(distuninstallcheck_listfiles) ; \
|
|
||||||
exit 1; } >&2
|
|
||||||
distcleancheck: distclean |
|
||||||
@if test '$(srcdir)' = . ; then \
|
|
||||||
echo "ERROR: distcleancheck can only run from a VPATH build" ; \
|
|
||||||
exit 1 ; \
|
|
||||||
fi
|
|
||||||
@test `$(distcleancheck_listfiles) | wc -l` -eq 0 \
|
|
||||||
|| { echo "ERROR: files left in build directory after distclean:" ; \
|
|
||||||
$(distcleancheck_listfiles) ; \
|
|
||||||
exit 1; } >&2
|
|
||||||
check-am: all-am |
|
||||||
check: check-am |
|
||||||
all-am: Makefile $(LTLIBRARIES) |
|
||||||
installdirs: |
|
||||||
for dir in "$(DESTDIR)$(libdir)"; do \
|
|
||||||
test -z "$$dir" || $(MKDIR_P) "$$dir"; \
|
|
||||||
done
|
|
||||||
install: install-am |
|
||||||
install-exec: install-exec-am |
|
||||||
install-data: install-data-am |
|
||||||
uninstall: uninstall-am |
|
||||||
|
|
||||||
install-am: all-am |
|
||||||
@$(MAKE) $(AM_MAKEFLAGS) install-exec-am install-data-am
|
|
||||||
|
|
||||||
installcheck: installcheck-am |
|
||||||
install-strip: |
|
||||||
if test -z '$(STRIP)'; then \
|
|
||||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
|
||||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
|
||||||
install; \
|
|
||||||
else \
|
|
||||||
$(MAKE) $(AM_MAKEFLAGS) INSTALL_PROGRAM="$(INSTALL_STRIP_PROGRAM)" \
|
|
||||||
install_sh_PROGRAM="$(INSTALL_STRIP_PROGRAM)" INSTALL_STRIP_FLAG=-s \
|
|
||||||
"INSTALL_PROGRAM_ENV=STRIPPROG='$(STRIP)'" install; \
|
|
||||||
fi
|
|
||||||
mostlyclean-generic: |
|
||||||
|
|
||||||
clean-generic: |
|
||||||
|
|
||||||
distclean-generic: |
|
||||||
-test -z "$(CONFIG_CLEAN_FILES)" || rm -f $(CONFIG_CLEAN_FILES)
|
|
||||||
-test . = "$(srcdir)" || test -z "$(CONFIG_CLEAN_VPATH_FILES)" || rm -f $(CONFIG_CLEAN_VPATH_FILES)
|
|
||||||
|
|
||||||
maintainer-clean-generic: |
|
||||||
@echo "This command is intended for maintainers to use"
|
|
||||||
@echo "it deletes files that may require special tools to rebuild."
|
|
||||||
clean: clean-am |
|
||||||
|
|
||||||
clean-am: clean-generic clean-libLTLIBRARIES clean-libtool \
|
|
||||||
mostlyclean-am
|
|
||||||
|
|
||||||
distclean: distclean-am |
|
||||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
|
||||||
-rm -f Makefile
|
|
||||||
distclean-am: clean-am distclean-compile distclean-generic \
|
|
||||||
distclean-hdr distclean-libtool distclean-tags
|
|
||||||
|
|
||||||
dvi: dvi-am |
|
||||||
|
|
||||||
dvi-am: |
|
||||||
|
|
||||||
html: html-am |
|
||||||
|
|
||||||
html-am: |
|
||||||
|
|
||||||
info: info-am |
|
||||||
|
|
||||||
info-am: |
|
||||||
|
|
||||||
install-data-am: |
|
||||||
|
|
||||||
install-dvi: install-dvi-am |
|
||||||
|
|
||||||
install-dvi-am: |
|
||||||
|
|
||||||
install-exec-am: install-libLTLIBRARIES |
|
||||||
|
|
||||||
install-html: install-html-am |
|
||||||
|
|
||||||
install-html-am: |
|
||||||
|
|
||||||
install-info: install-info-am |
|
||||||
|
|
||||||
install-info-am: |
|
||||||
|
|
||||||
install-man: |
|
||||||
|
|
||||||
install-pdf: install-pdf-am |
|
||||||
|
|
||||||
install-pdf-am: |
|
||||||
|
|
||||||
install-ps: install-ps-am |
|
||||||
|
|
||||||
install-ps-am: |
|
||||||
|
|
||||||
installcheck-am: |
|
||||||
|
|
||||||
maintainer-clean: maintainer-clean-am |
|
||||||
-rm -f $(am__CONFIG_DISTCLEAN_FILES)
|
|
||||||
-rm -rf $(top_srcdir)/autom4te.cache
|
|
||||||
-rm -f Makefile
|
|
||||||
maintainer-clean-am: distclean-am maintainer-clean-generic |
|
||||||
|
|
||||||
mostlyclean: mostlyclean-am |
|
||||||
|
|
||||||
mostlyclean-am: mostlyclean-compile mostlyclean-generic \
|
|
||||||
mostlyclean-libtool
|
|
||||||
|
|
||||||
pdf: pdf-am |
|
||||||
|
|
||||||
pdf-am: |
|
||||||
|
|
||||||
ps: ps-am |
|
||||||
|
|
||||||
ps-am: |
|
||||||
|
|
||||||
uninstall-am: uninstall-libLTLIBRARIES |
|
||||||
|
|
||||||
.MAKE: install-am install-strip |
|
||||||
|
|
||||||
.PHONY: CTAGS GTAGS all all-am am--refresh check check-am clean \
|
|
||||||
clean-cscope clean-generic clean-libLTLIBRARIES clean-libtool \
|
|
||||||
cscope cscopelist ctags dist dist-all dist-bzip2 dist-gzip \
|
|
||||||
dist-lzip dist-shar dist-tarZ dist-xz dist-zip distcheck \
|
|
||||||
distclean distclean-compile distclean-generic distclean-hdr \
|
|
||||||
distclean-libtool distclean-tags distcleancheck distdir \
|
|
||||||
distuninstallcheck dvi dvi-am html html-am info info-am \
|
|
||||||
install install-am install-data install-data-am install-dvi \
|
|
||||||
install-dvi-am install-exec install-exec-am install-html \
|
|
||||||
install-html-am install-info install-info-am \
|
|
||||||
install-libLTLIBRARIES install-man install-pdf install-pdf-am \
|
|
||||||
install-ps install-ps-am install-strip installcheck \
|
|
||||||
installcheck-am installdirs maintainer-clean \
|
|
||||||
maintainer-clean-generic mostlyclean mostlyclean-compile \
|
|
||||||
mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
|
|
||||||
tags uninstall uninstall-am uninstall-libLTLIBRARIES
|
|
||||||
|
|
||||||
|
|
||||||
# Tell versions [3.59,3.63) of GNU make to not export all variables.
|
|
||||||
# Otherwise a system limit (for SysV at least) may be exceeded.
|
|
||||||
.NOEXPORT: |
|
@ -1,718 +0,0 @@ |
|||||||
# generated automatically by aclocal 1.12.1 -*- Autoconf -*- |
|
||||||
|
|
||||||
# Copyright (C) 1996-2012 Free Software Foundation, Inc. |
|
||||||
|
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# This program is distributed in the hope that it will be useful, |
|
||||||
# but WITHOUT ANY WARRANTY, to the extent permitted by law; without |
|
||||||
# even the implied warranty of MERCHANTABILITY or FITNESS FOR A |
|
||||||
# PARTICULAR PURPOSE. |
|
||||||
|
|
||||||
m4_ifndef([AC_AUTOCONF_VERSION], |
|
||||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl |
|
||||||
m4_if(m4_defn([AC_AUTOCONF_VERSION]), [2.69],, |
|
||||||
[m4_warning([this file was generated for autoconf 2.69. |
|
||||||
You have another version of autoconf. It may work, but is not guaranteed to. |
|
||||||
If you have problems, you may need to regenerate the build system entirely. |
|
||||||
To do so, use the procedure documented by the package, typically 'autoreconf'.])]) |
|
||||||
|
|
||||||
# Copyright (C) 2002-2012 Free Software Foundation, Inc. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 8 |
|
||||||
|
|
||||||
# AM_AUTOMAKE_VERSION(VERSION) |
|
||||||
# ---------------------------- |
|
||||||
# Automake X.Y traces this macro to ensure aclocal.m4 has been |
|
||||||
# generated from the m4 files accompanying Automake X.Y. |
|
||||||
# (This private macro should not be called outside this file.) |
|
||||||
AC_DEFUN([AM_AUTOMAKE_VERSION], |
|
||||||
[am__api_version='1.12' |
|
||||||
dnl Some users find AM_AUTOMAKE_VERSION and mistake it for a way to |
|
||||||
dnl require some minimum version. Point them to the right macro. |
|
||||||
m4_if([$1], [1.12.1], [], |
|
||||||
[AC_FATAL([Do not call $0, use AM_INIT_AUTOMAKE([$1]).])])dnl |
|
||||||
]) |
|
||||||
|
|
||||||
# _AM_AUTOCONF_VERSION(VERSION) |
|
||||||
# ----------------------------- |
|
||||||
# aclocal traces this macro to find the Autoconf version. |
|
||||||
# This is a private macro too. Using m4_define simplifies |
|
||||||
# the logic in aclocal, which can simply ignore this definition. |
|
||||||
m4_define([_AM_AUTOCONF_VERSION], []) |
|
||||||
|
|
||||||
# AM_SET_CURRENT_AUTOMAKE_VERSION |
|
||||||
# ------------------------------- |
|
||||||
# Call AM_AUTOMAKE_VERSION and AM_AUTOMAKE_VERSION so they can be traced. |
|
||||||
# This function is AC_REQUIREd by AM_INIT_AUTOMAKE. |
|
||||||
AC_DEFUN([AM_SET_CURRENT_AUTOMAKE_VERSION], |
|
||||||
[AM_AUTOMAKE_VERSION([1.12.1])dnl |
|
||||||
m4_ifndef([AC_AUTOCONF_VERSION], |
|
||||||
[m4_copy([m4_PACKAGE_VERSION], [AC_AUTOCONF_VERSION])])dnl |
|
||||||
_AM_AUTOCONF_VERSION(m4_defn([AC_AUTOCONF_VERSION]))]) |
|
||||||
|
|
||||||
# Copyright (C) 2011-2012 Free Software Foundation, Inc. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 1 |
|
||||||
|
|
||||||
# AM_PROG_AR([ACT-IF-FAIL]) |
|
||||||
# ------------------------- |
|
||||||
# Try to determine the archiver interface, and trigger the ar-lib wrapper |
|
||||||
# if it is needed. If the detection of archiver interface fails, run |
|
||||||
# ACT-IF-FAIL (default is to abort configure with a proper error message). |
|
||||||
AC_DEFUN([AM_PROG_AR], |
|
||||||
[AC_BEFORE([$0], [LT_INIT])dnl |
|
||||||
AC_BEFORE([$0], [AC_PROG_LIBTOOL])dnl |
|
||||||
AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl |
|
||||||
AC_REQUIRE_AUX_FILE([ar-lib])dnl |
|
||||||
AC_CHECK_TOOLS([AR], [ar lib "link -lib"], [false]) |
|
||||||
: ${AR=ar} |
|
||||||
|
|
||||||
AC_CACHE_CHECK([the archiver ($AR) interface], [am_cv_ar_interface], |
|
||||||
[am_cv_ar_interface=ar |
|
||||||
AC_COMPILE_IFELSE([AC_LANG_SOURCE([[int some_variable = 0;]])], |
|
||||||
[am_ar_try='$AR cru libconftest.a conftest.$ac_objext >&AS_MESSAGE_LOG_FD' |
|
||||||
AC_TRY_EVAL([am_ar_try]) |
|
||||||
if test "$ac_status" -eq 0; then |
|
||||||
am_cv_ar_interface=ar |
|
||||||
else |
|
||||||
am_ar_try='$AR -NOLOGO -OUT:conftest.lib conftest.$ac_objext >&AS_MESSAGE_LOG_FD' |
|
||||||
AC_TRY_EVAL([am_ar_try]) |
|
||||||
if test "$ac_status" -eq 0; then |
|
||||||
am_cv_ar_interface=lib |
|
||||||
else |
|
||||||
am_cv_ar_interface=unknown |
|
||||||
fi |
|
||||||
fi |
|
||||||
rm -f conftest.lib libconftest.a |
|
||||||
]) |
|
||||||
]) |
|
||||||
|
|
||||||
case $am_cv_ar_interface in |
|
||||||
ar) |
|
||||||
;; |
|
||||||
lib) |
|
||||||
# Microsoft lib, so override with the ar-lib wrapper script. |
|
||||||
# FIXME: It is wrong to rewrite AR. |
|
||||||
# But if we don't then we get into trouble of one sort or another. |
|
||||||
# A longer-term fix would be to have automake use am__AR in this case, |
|
||||||
# and then we could set am__AR="$am_aux_dir/ar-lib \$(AR)" or something |
|
||||||
# similar. |
|
||||||
AR="$am_aux_dir/ar-lib $AR" |
|
||||||
;; |
|
||||||
unknown) |
|
||||||
m4_default([$1], |
|
||||||
[AC_MSG_ERROR([could not determine $AR interface])]) |
|
||||||
;; |
|
||||||
esac |
|
||||||
AC_SUBST([AR])dnl |
|
||||||
]) |
|
||||||
|
|
||||||
# AM_AUX_DIR_EXPAND -*- Autoconf -*- |
|
||||||
|
|
||||||
# Copyright (C) 2001-2012 Free Software Foundation, Inc. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 2 |
|
||||||
|
|
||||||
# For projects using AC_CONFIG_AUX_DIR([foo]), Autoconf sets |
|
||||||
# $ac_aux_dir to '$srcdir/foo'. In other projects, it is set to |
|
||||||
# '$srcdir', '$srcdir/..', or '$srcdir/../..'. |
|
||||||
# |
|
||||||
# Of course, Automake must honor this variable whenever it calls a |
|
||||||
# tool from the auxiliary directory. The problem is that $srcdir (and |
|
||||||
# therefore $ac_aux_dir as well) can be either absolute or relative, |
|
||||||
# depending on how configure is run. This is pretty annoying, since |
|
||||||
# it makes $ac_aux_dir quite unusable in subdirectories: in the top |
|
||||||
# source directory, any form will work fine, but in subdirectories a |
|
||||||
# relative path needs to be adjusted first. |
|
||||||
# |
|
||||||
# $ac_aux_dir/missing |
|
||||||
# fails when called from a subdirectory if $ac_aux_dir is relative |
|
||||||
# $top_srcdir/$ac_aux_dir/missing |
|
||||||
# fails if $ac_aux_dir is absolute, |
|
||||||
# fails when called from a subdirectory in a VPATH build with |
|
||||||
# a relative $ac_aux_dir |
|
||||||
# |
|
||||||
# The reason of the latter failure is that $top_srcdir and $ac_aux_dir |
|
||||||
# are both prefixed by $srcdir. In an in-source build this is usually |
|
||||||
# harmless because $srcdir is '.', but things will broke when you |
|
||||||
# start a VPATH build or use an absolute $srcdir. |
|
||||||
# |
|
||||||
# So we could use something similar to $top_srcdir/$ac_aux_dir/missing, |
|
||||||
# iff we strip the leading $srcdir from $ac_aux_dir. That would be: |
|
||||||
# am_aux_dir='\$(top_srcdir)/'`expr "$ac_aux_dir" : "$srcdir//*\(.*\)"` |
|
||||||
# and then we would define $MISSING as |
|
||||||
# MISSING="\${SHELL} $am_aux_dir/missing" |
|
||||||
# This will work as long as MISSING is not called from configure, because |
|
||||||
# unfortunately $(top_srcdir) has no meaning in configure. |
|
||||||
# However there are other variables, like CC, which are often used in |
|
||||||
# configure, and could therefore not use this "fixed" $ac_aux_dir. |
|
||||||
# |
|
||||||
# Another solution, used here, is to always expand $ac_aux_dir to an |
|
||||||
# absolute PATH. The drawback is that using absolute paths prevent a |
|
||||||
# configured tree to be moved without reconfiguration. |
|
||||||
|
|
||||||
AC_DEFUN([AM_AUX_DIR_EXPAND], |
|
||||||
[dnl Rely on autoconf to set up CDPATH properly. |
|
||||||
AC_PREREQ([2.50])dnl |
|
||||||
# expand $ac_aux_dir to an absolute path |
|
||||||
am_aux_dir=`cd $ac_aux_dir && pwd` |
|
||||||
]) |
|
||||||
|
|
||||||
# AM_CONDITIONAL -*- Autoconf -*- |
|
||||||
|
|
||||||
# Copyright (C) 1997-2012 Free Software Foundation, Inc. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 10 |
|
||||||
|
|
||||||
# AM_CONDITIONAL(NAME, SHELL-CONDITION) |
|
||||||
# ------------------------------------- |
|
||||||
# Define a conditional. |
|
||||||
AC_DEFUN([AM_CONDITIONAL], |
|
||||||
[AC_PREREQ([2.52])dnl |
|
||||||
m4_if([$1], [TRUE], [AC_FATAL([$0: invalid condition: $1])], |
|
||||||
[$1], [FALSE], [AC_FATAL([$0: invalid condition: $1])])dnl |
|
||||||
AC_SUBST([$1_TRUE])dnl |
|
||||||
AC_SUBST([$1_FALSE])dnl |
|
||||||
_AM_SUBST_NOTMAKE([$1_TRUE])dnl |
|
||||||
_AM_SUBST_NOTMAKE([$1_FALSE])dnl |
|
||||||
m4_define([_AM_COND_VALUE_$1], [$2])dnl |
|
||||||
if $2; then |
|
||||||
$1_TRUE= |
|
||||||
$1_FALSE='#' |
|
||||||
else |
|
||||||
$1_TRUE='#' |
|
||||||
$1_FALSE= |
|
||||||
fi |
|
||||||
AC_CONFIG_COMMANDS_PRE( |
|
||||||
[if test -z "${$1_TRUE}" && test -z "${$1_FALSE}"; then |
|
||||||
AC_MSG_ERROR([[conditional "$1" was never defined. |
|
||||||
Usually this means the macro was only invoked conditionally.]]) |
|
||||||
fi])]) |
|
||||||
|
|
||||||
# Do all the work for Automake. -*- Autoconf -*- |
|
||||||
|
|
||||||
# Copyright (C) 1996-2012 Free Software Foundation, Inc. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 19 |
|
||||||
|
|
||||||
# This macro actually does too much. Some checks are only needed if |
|
||||||
# your package does certain things. But this isn't really a big deal. |
|
||||||
|
|
||||||
# AM_INIT_AUTOMAKE(PACKAGE, VERSION, [NO-DEFINE]) |
|
||||||
# AM_INIT_AUTOMAKE([OPTIONS]) |
|
||||||
# ----------------------------------------------- |
|
||||||
# The call with PACKAGE and VERSION arguments is the old style |
|
||||||
# call (pre autoconf-2.50), which is being phased out. PACKAGE |
|
||||||
# and VERSION should now be passed to AC_INIT and removed from |
|
||||||
# the call to AM_INIT_AUTOMAKE. |
|
||||||
# We support both call styles for the transition. After |
|
||||||
# the next Automake release, Autoconf can make the AC_INIT |
|
||||||
# arguments mandatory, and then we can depend on a new Autoconf |
|
||||||
# release and drop the old call support. |
|
||||||
AC_DEFUN([AM_INIT_AUTOMAKE], |
|
||||||
[AC_PREREQ([2.62])dnl |
|
||||||
dnl Autoconf wants to disallow AM_ names. We explicitly allow |
|
||||||
dnl the ones we care about. |
|
||||||
m4_pattern_allow([^AM_[A-Z]+FLAGS$])dnl |
|
||||||
AC_REQUIRE([AM_SET_CURRENT_AUTOMAKE_VERSION])dnl |
|
||||||
AC_REQUIRE([AC_PROG_INSTALL])dnl |
|
||||||
if test "`cd $srcdir && pwd`" != "`pwd`"; then |
|
||||||
# Use -I$(srcdir) only when $(srcdir) != ., so that make's output |
|
||||||
# is not polluted with repeated "-I." |
|
||||||
AC_SUBST([am__isrc], [' -I$(srcdir)'])_AM_SUBST_NOTMAKE([am__isrc])dnl |
|
||||||
# test to see if srcdir already configured |
|
||||||
if test -f $srcdir/config.status; then |
|
||||||
AC_MSG_ERROR([source directory already configured; run "make distclean" there first]) |
|
||||||
fi |
|
||||||
fi |
|
||||||
|
|
||||||
# test whether we have cygpath |
|
||||||
if test -z "$CYGPATH_W"; then |
|
||||||
if (cygpath --version) >/dev/null 2>/dev/null; then |
|
||||||
CYGPATH_W='cygpath -w' |
|
||||||
else |
|
||||||
CYGPATH_W=echo |
|
||||||
fi |
|
||||||
fi |
|
||||||
AC_SUBST([CYGPATH_W]) |
|
||||||
|
|
||||||
# Define the identity of the package. |
|
||||||
dnl Distinguish between old-style and new-style calls. |
|
||||||
m4_ifval([$2], |
|
||||||
[AC_DIAGNOSE([obsolete], |
|
||||||
[$0: two- and three-arguments forms are deprecated. For more info, see: |
|
||||||
http://www.gnu.org/software/automake/manual/automake.html#Modernize-AM_INIT_AUTOMAKE-invocation]) |
|
||||||
m4_ifval([$3], [_AM_SET_OPTION([no-define])])dnl |
|
||||||
AC_SUBST([PACKAGE], [$1])dnl |
|
||||||
AC_SUBST([VERSION], [$2])], |
|
||||||
[_AM_SET_OPTIONS([$1])dnl |
|
||||||
dnl Diagnose old-style AC_INIT with new-style AM_AUTOMAKE_INIT. |
|
||||||
m4_if( |
|
||||||
m4_ifdef([AC_PACKAGE_NAME], [ok]):m4_ifdef([AC_PACKAGE_VERSION], [ok]), |
|
||||||
[ok:ok],, |
|
||||||
[m4_fatal([AC_INIT should be called with package and version arguments])])dnl |
|
||||||
AC_SUBST([PACKAGE], ['AC_PACKAGE_TARNAME'])dnl |
|
||||||
AC_SUBST([VERSION], ['AC_PACKAGE_VERSION'])])dnl |
|
||||||
|
|
||||||
_AM_IF_OPTION([no-define],, |
|
||||||
[AC_DEFINE_UNQUOTED([PACKAGE], ["$PACKAGE"], [Name of package]) |
|
||||||
AC_DEFINE_UNQUOTED([VERSION], ["$VERSION"], [Version number of package])])dnl |
|
||||||
|
|
||||||
# Some tools Automake needs. |
|
||||||
AC_REQUIRE([AM_SANITY_CHECK])dnl |
|
||||||
AC_REQUIRE([AC_ARG_PROGRAM])dnl |
|
||||||
AM_MISSING_PROG([ACLOCAL], [aclocal-${am__api_version}]) |
|
||||||
AM_MISSING_PROG([AUTOCONF], [autoconf]) |
|
||||||
AM_MISSING_PROG([AUTOMAKE], [automake-${am__api_version}]) |
|
||||||
AM_MISSING_PROG([AUTOHEADER], [autoheader]) |
|
||||||
AM_MISSING_PROG([MAKEINFO], [makeinfo]) |
|
||||||
AC_REQUIRE([AM_PROG_INSTALL_SH])dnl |
|
||||||
AC_REQUIRE([AM_PROG_INSTALL_STRIP])dnl |
|
||||||
AC_REQUIRE([AC_PROG_MKDIR_P])dnl |
|
||||||
# We need awk for the "check" target. The system "awk" is bad on |
|
||||||
# some platforms. |
|
||||||
AC_REQUIRE([AC_PROG_AWK])dnl |
|
||||||
AC_REQUIRE([AC_PROG_MAKE_SET])dnl |
|
||||||
AC_REQUIRE([AM_SET_LEADING_DOT])dnl |
|
||||||
_AM_IF_OPTION([tar-ustar], [_AM_PROG_TAR([ustar])], |
|
||||||
[_AM_IF_OPTION([tar-pax], [_AM_PROG_TAR([pax])], |
|
||||||
[_AM_PROG_TAR([v7])])]) |
|
||||||
_AM_IF_OPTION([no-dependencies],, |
|
||||||
[AC_PROVIDE_IFELSE([AC_PROG_CC], |
|
||||||
[_AM_DEPENDENCIES([CC])], |
|
||||||
[m4_define([AC_PROG_CC], |
|
||||||
m4_defn([AC_PROG_CC])[_AM_DEPENDENCIES([CC])])])dnl |
|
||||||
AC_PROVIDE_IFELSE([AC_PROG_CXX], |
|
||||||
[_AM_DEPENDENCIES([CXX])], |
|
||||||
[m4_define([AC_PROG_CXX], |
|
||||||
m4_defn([AC_PROG_CXX])[_AM_DEPENDENCIES([CXX])])])dnl |
|
||||||
AC_PROVIDE_IFELSE([AC_PROG_OBJC], |
|
||||||
[_AM_DEPENDENCIES([OBJC])], |
|
||||||
[m4_define([AC_PROG_OBJC], |
|
||||||
m4_defn([AC_PROG_OBJC])[_AM_DEPENDENCIES([OBJC])])])dnl |
|
||||||
dnl Support for Objective C++ was only introduced in Autoconf 2.65, |
|
||||||
dnl but we still cater to Autoconf 2.62. |
|
||||||
m4_ifdef([AC_PROG_OBJCXX], |
|
||||||
[AC_PROVIDE_IFELSE([AC_PROG_OBJCXX], |
|
||||||
[_AM_DEPENDENCIES([OBJCXX])], |
|
||||||
[m4_define([AC_PROG_OBJCXX], |
|
||||||
m4_defn([AC_PROG_OBJCXX])[_AM_DEPENDENCIES([OBJCXX])])])])dnl |
|
||||||
]) |
|
||||||
_AM_IF_OPTION([silent-rules], [AC_REQUIRE([AM_SILENT_RULES])])dnl |
|
||||||
dnl The 'parallel-tests' driver may need to know about EXEEXT, so add the |
|
||||||
dnl 'am__EXEEXT' conditional if _AM_COMPILER_EXEEXT was seen. This macro |
|
||||||
dnl is hooked onto _AC_COMPILER_EXEEXT early, see below. |
|
||||||
AC_CONFIG_COMMANDS_PRE(dnl |
|
||||||
[m4_provide_if([_AM_COMPILER_EXEEXT], |
|
||||||
[AM_CONDITIONAL([am__EXEEXT], [test -n "$EXEEXT"])])])dnl |
|
||||||
]) |
|
||||||
|
|
||||||
dnl Hook into '_AC_COMPILER_EXEEXT' early to learn its expansion. Do not |
|
||||||
dnl add the conditional right here, as _AC_COMPILER_EXEEXT may be further |
|
||||||
dnl mangled by Autoconf and run in a shell conditional statement. |
|
||||||
m4_define([_AC_COMPILER_EXEEXT], |
|
||||||
m4_defn([_AC_COMPILER_EXEEXT])[m4_provide([_AM_COMPILER_EXEEXT])]) |
|
||||||
|
|
||||||
|
|
||||||
# When config.status generates a header, we must update the stamp-h file. |
|
||||||
# This file resides in the same directory as the config header |
|
||||||
# that is generated. The stamp files are numbered to have different names. |
|
||||||
|
|
||||||
# Autoconf calls _AC_AM_CONFIG_HEADER_HOOK (when defined) in the |
|
||||||
# loop where config.status creates the headers, so we can generate |
|
||||||
# our stamp files there. |
|
||||||
AC_DEFUN([_AC_AM_CONFIG_HEADER_HOOK], |
|
||||||
[# Compute $1's index in $config_headers. |
|
||||||
_am_arg=$1 |
|
||||||
_am_stamp_count=1 |
|
||||||
for _am_header in $config_headers :; do |
|
||||||
case $_am_header in |
|
||||||
$_am_arg | $_am_arg:* ) |
|
||||||
break ;; |
|
||||||
* ) |
|
||||||
_am_stamp_count=`expr $_am_stamp_count + 1` ;; |
|
||||||
esac |
|
||||||
done |
|
||||||
echo "timestamp for $_am_arg" >`AS_DIRNAME(["$_am_arg"])`/stamp-h[]$_am_stamp_count]) |
|
||||||
|
|
||||||
# Copyright (C) 2001-2012 Free Software Foundation, Inc. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 8 |
|
||||||
|
|
||||||
# AM_PROG_INSTALL_SH |
|
||||||
# ------------------ |
|
||||||
# Define $install_sh. |
|
||||||
AC_DEFUN([AM_PROG_INSTALL_SH], |
|
||||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl |
|
||||||
if test x"${install_sh}" != xset; then |
|
||||||
case $am_aux_dir in |
|
||||||
*\ * | *\ *) |
|
||||||
install_sh="\${SHELL} '$am_aux_dir/install-sh'" ;; |
|
||||||
*) |
|
||||||
install_sh="\${SHELL} $am_aux_dir/install-sh" |
|
||||||
esac |
|
||||||
fi |
|
||||||
AC_SUBST([install_sh])]) |
|
||||||
|
|
||||||
# Copyright (C) 2003-2012 Free Software Foundation, Inc. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 2 |
|
||||||
|
|
||||||
# Check whether the underlying file-system supports filenames |
|
||||||
# with a leading dot. For instance MS-DOS doesn't. |
|
||||||
AC_DEFUN([AM_SET_LEADING_DOT], |
|
||||||
[rm -rf .tst 2>/dev/null |
|
||||||
mkdir .tst 2>/dev/null |
|
||||||
if test -d .tst; then |
|
||||||
am__leading_dot=. |
|
||||||
else |
|
||||||
am__leading_dot=_ |
|
||||||
fi |
|
||||||
rmdir .tst 2>/dev/null |
|
||||||
AC_SUBST([am__leading_dot])]) |
|
||||||
|
|
||||||
# Fake the existence of programs that GNU maintainers use. -*- Autoconf -*- |
|
||||||
|
|
||||||
# Copyright (C) 1997-2012 Free Software Foundation, Inc. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 7 |
|
||||||
|
|
||||||
# AM_MISSING_PROG(NAME, PROGRAM) |
|
||||||
# ------------------------------ |
|
||||||
AC_DEFUN([AM_MISSING_PROG], |
|
||||||
[AC_REQUIRE([AM_MISSING_HAS_RUN]) |
|
||||||
$1=${$1-"${am_missing_run}$2"} |
|
||||||
AC_SUBST($1)]) |
|
||||||
|
|
||||||
|
|
||||||
# AM_MISSING_HAS_RUN |
|
||||||
# ------------------ |
|
||||||
# Define MISSING if not defined so far and test if it supports --run. |
|
||||||
# If it does, set am_missing_run to use it, otherwise, to nothing. |
|
||||||
AC_DEFUN([AM_MISSING_HAS_RUN], |
|
||||||
[AC_REQUIRE([AM_AUX_DIR_EXPAND])dnl |
|
||||||
AC_REQUIRE_AUX_FILE([missing])dnl |
|
||||||
if test x"${MISSING+set}" != xset; then |
|
||||||
case $am_aux_dir in |
|
||||||
*\ * | *\ *) |
|
||||||
MISSING="\${SHELL} \"$am_aux_dir/missing\"" ;; |
|
||||||
*) |
|
||||||
MISSING="\${SHELL} $am_aux_dir/missing" ;; |
|
||||||
esac |
|
||||||
fi |
|
||||||
# Use eval to expand $SHELL |
|
||||||
if eval "$MISSING --run true"; then |
|
||||||
am_missing_run="$MISSING --run " |
|
||||||
else |
|
||||||
am_missing_run= |
|
||||||
AC_MSG_WARN(['missing' script is too old or missing]) |
|
||||||
fi |
|
||||||
]) |
|
||||||
|
|
||||||
# Helper functions for option handling. -*- Autoconf -*- |
|
||||||
|
|
||||||
# Copyright (C) 2001-2012 Free Software Foundation, Inc. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 6 |
|
||||||
|
|
||||||
# _AM_MANGLE_OPTION(NAME) |
|
||||||
# ----------------------- |
|
||||||
AC_DEFUN([_AM_MANGLE_OPTION], |
|
||||||
[[_AM_OPTION_]m4_bpatsubst($1, [[^a-zA-Z0-9_]], [_])]) |
|
||||||
|
|
||||||
# _AM_SET_OPTION(NAME) |
|
||||||
# -------------------- |
|
||||||
# Set option NAME. Presently that only means defining a flag for this option. |
|
||||||
AC_DEFUN([_AM_SET_OPTION], |
|
||||||
[m4_define(_AM_MANGLE_OPTION([$1]), [1])]) |
|
||||||
|
|
||||||
# _AM_SET_OPTIONS(OPTIONS) |
|
||||||
# ------------------------ |
|
||||||
# OPTIONS is a space-separated list of Automake options. |
|
||||||
AC_DEFUN([_AM_SET_OPTIONS], |
|
||||||
[m4_foreach_w([_AM_Option], [$1], [_AM_SET_OPTION(_AM_Option)])]) |
|
||||||
|
|
||||||
# _AM_IF_OPTION(OPTION, IF-SET, [IF-NOT-SET]) |
|
||||||
# ------------------------------------------- |
|
||||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. |
|
||||||
AC_DEFUN([_AM_IF_OPTION], |
|
||||||
[m4_ifset(_AM_MANGLE_OPTION([$1]), [$2], [$3])]) |
|
||||||
|
|
||||||
# Check to make sure that the build environment is sane. -*- Autoconf -*- |
|
||||||
|
|
||||||
# Copyright (C) 1996-2012 Free Software Foundation, Inc. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 9 |
|
||||||
|
|
||||||
# AM_SANITY_CHECK |
|
||||||
# --------------- |
|
||||||
AC_DEFUN([AM_SANITY_CHECK], |
|
||||||
[AC_MSG_CHECKING([whether build environment is sane]) |
|
||||||
# Reject unsafe characters in $srcdir or the absolute working directory |
|
||||||
# name. Accept space and tab only in the latter. |
|
||||||
am_lf=' |
|
||||||
' |
|
||||||
case `pwd` in |
|
||||||
*[[\\\"\#\$\&\'\`$am_lf]]*) |
|
||||||
AC_MSG_ERROR([unsafe absolute working directory name]);; |
|
||||||
esac |
|
||||||
case $srcdir in |
|
||||||
*[[\\\"\#\$\&\'\`$am_lf\ \ ]]*) |
|
||||||
AC_MSG_ERROR([unsafe srcdir value: '$srcdir']);; |
|
||||||
esac |
|
||||||
|
|
||||||
# Do 'set' in a subshell so we don't clobber the current shell's |
|
||||||
# arguments. Must try -L first in case configure is actually a |
|
||||||
# symlink; some systems play weird games with the mod time of symlinks |
|
||||||
# (eg FreeBSD returns the mod time of the symlink's containing |
|
||||||
# directory). |
|
||||||
if ( |
|
||||||
am_has_slept=no |
|
||||||
for am_try in 1 2; do |
|
||||||
echo "timestamp, slept: $am_has_slept" > conftest.file |
|
||||||
set X `ls -Lt "$srcdir/configure" conftest.file 2> /dev/null` |
|
||||||
if test "$[*]" = "X"; then |
|
||||||
# -L didn't work. |
|
||||||
set X `ls -t "$srcdir/configure" conftest.file` |
|
||||||
fi |
|
||||||
if test "$[*]" != "X $srcdir/configure conftest.file" \ |
|
||||||
&& test "$[*]" != "X conftest.file $srcdir/configure"; then |
|
||||||
|
|
||||||
# If neither matched, then we have a broken ls. This can happen |
|
||||||
# if, for instance, CONFIG_SHELL is bash and it inherits a |
|
||||||
# broken ls alias from the environment. This has actually |
|
||||||
# happened. Such a system could not be considered "sane". |
|
||||||
AC_MSG_ERROR([ls -t appears to fail. Make sure there is not a broken |
|
||||||
alias in your environment]) |
|
||||||
fi |
|
||||||
if test "$[2]" = conftest.file || test $am_try -eq 2; then |
|
||||||
break |
|
||||||
fi |
|
||||||
# Just in case. |
|
||||||
sleep 1 |
|
||||||
am_has_slept=yes |
|
||||||
done |
|
||||||
test "$[2]" = conftest.file |
|
||||||
) |
|
||||||
then |
|
||||||
# Ok. |
|
||||||
: |
|
||||||
else |
|
||||||
AC_MSG_ERROR([newly created file is older than distributed files! |
|
||||||
Check your system clock]) |
|
||||||
fi |
|
||||||
AC_MSG_RESULT([yes]) |
|
||||||
# If we didn't sleep, we still need to ensure time stamps of config.status and |
|
||||||
# generated files are strictly newer. |
|
||||||
am_sleep_pid= |
|
||||||
if grep 'slept: no' conftest.file >/dev/null 2>&1; then |
|
||||||
( sleep 1 ) & |
|
||||||
am_sleep_pid=$! |
|
||||||
fi |
|
||||||
AC_CONFIG_COMMANDS_PRE( |
|
||||||
[AC_MSG_CHECKING([that generated files are newer than configure]) |
|
||||||
if test -n "$am_sleep_pid"; then |
|
||||||
# Hide warnings about reused PIDs. |
|
||||||
wait $am_sleep_pid 2>/dev/null |
|
||||||
fi |
|
||||||
AC_MSG_RESULT([done])]) |
|
||||||
rm -f conftest.file |
|
||||||
]) |
|
||||||
|
|
||||||
# Copyright (C) 2001-2012 Free Software Foundation, Inc. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 2 |
|
||||||
|
|
||||||
# AM_PROG_INSTALL_STRIP |
|
||||||
# --------------------- |
|
||||||
# One issue with vendor 'install' (even GNU) is that you can't |
|
||||||
# specify the program used to strip binaries. This is especially |
|
||||||
# annoying in cross-compiling environments, where the build's strip |
|
||||||
# is unlikely to handle the host's binaries. |
|
||||||
# Fortunately install-sh will honor a STRIPPROG variable, so we |
|
||||||
# always use install-sh in "make install-strip", and initialize |
|
||||||
# STRIPPROG with the value of the STRIP variable (set by the user). |
|
||||||
AC_DEFUN([AM_PROG_INSTALL_STRIP], |
|
||||||
[AC_REQUIRE([AM_PROG_INSTALL_SH])dnl |
|
||||||
# Installed binaries are usually stripped using 'strip' when the user |
|
||||||
# run "make install-strip". However 'strip' might not be the right |
|
||||||
# tool to use in cross-compilation environments, therefore Automake |
|
||||||
# will honor the 'STRIP' environment variable to overrule this program. |
|
||||||
dnl Don't test for $cross_compiling = yes, because it might be 'maybe'. |
|
||||||
if test "$cross_compiling" != no; then |
|
||||||
AC_CHECK_TOOL([STRIP], [strip], :) |
|
||||||
fi |
|
||||||
INSTALL_STRIP_PROGRAM="\$(install_sh) -c -s" |
|
||||||
AC_SUBST([INSTALL_STRIP_PROGRAM])]) |
|
||||||
|
|
||||||
# Copyright (C) 2006-2012 Free Software Foundation, Inc. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 3 |
|
||||||
|
|
||||||
# _AM_SUBST_NOTMAKE(VARIABLE) |
|
||||||
# --------------------------- |
|
||||||
# Prevent Automake from outputting VARIABLE = @VARIABLE@ in Makefile.in. |
|
||||||
# This macro is traced by Automake. |
|
||||||
AC_DEFUN([_AM_SUBST_NOTMAKE]) |
|
||||||
|
|
||||||
# AM_SUBST_NOTMAKE(VARIABLE) |
|
||||||
# -------------------------- |
|
||||||
# Public sister of _AM_SUBST_NOTMAKE. |
|
||||||
AC_DEFUN([AM_SUBST_NOTMAKE], [_AM_SUBST_NOTMAKE($@)]) |
|
||||||
|
|
||||||
# Check how to create a tarball. -*- Autoconf -*- |
|
||||||
|
|
||||||
# Copyright (C) 2004-2012 Free Software Foundation, Inc. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation |
|
||||||
# gives unlimited permission to copy and/or distribute it, |
|
||||||
# with or without modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 3 |
|
||||||
|
|
||||||
# _AM_PROG_TAR(FORMAT) |
|
||||||
# -------------------- |
|
||||||
# Check how to create a tarball in format FORMAT. |
|
||||||
# FORMAT should be one of 'v7', 'ustar', or 'pax'. |
|
||||||
# |
|
||||||
# Substitute a variable $(am__tar) that is a command |
|
||||||
# writing to stdout a FORMAT-tarball containing the directory |
|
||||||
# $tardir. |
|
||||||
# tardir=directory && $(am__tar) > result.tar |
|
||||||
# |
|
||||||
# Substitute a variable $(am__untar) that extract such |
|
||||||
# a tarball read from stdin. |
|
||||||
# $(am__untar) < result.tar |
|
||||||
AC_DEFUN([_AM_PROG_TAR], |
|
||||||
[# Always define AMTAR for backward compatibility. Yes, it's still used |
|
||||||
# in the wild :-( We should find a proper way to deprecate it ... |
|
||||||
AC_SUBST([AMTAR], ['$${TAR-tar}']) |
|
||||||
m4_if([$1], [v7], |
|
||||||
[am__tar='$${TAR-tar} chof - "$$tardir"' am__untar='$${TAR-tar} xf -'], |
|
||||||
[m4_case([$1], [ustar],, [pax],, |
|
||||||
[m4_fatal([Unknown tar format])]) |
|
||||||
AC_MSG_CHECKING([how to create a $1 tar archive]) |
|
||||||
# Loop over all known methods to create a tar archive until one works. |
|
||||||
_am_tools='gnutar m4_if([$1], [ustar], [plaintar]) pax cpio none' |
|
||||||
_am_tools=${am_cv_prog_tar_$1-$_am_tools} |
|
||||||
# Do not fold the above two line into one, because Tru64 sh and |
|
||||||
# Solaris sh will not grok spaces in the rhs of '-'. |
|
||||||
for _am_tool in $_am_tools |
|
||||||
do |
|
||||||
case $_am_tool in |
|
||||||
gnutar) |
|
||||||
for _am_tar in tar gnutar gtar; |
|
||||||
do |
|
||||||
AM_RUN_LOG([$_am_tar --version]) && break |
|
||||||
done |
|
||||||
am__tar="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$$tardir"' |
|
||||||
am__tar_="$_am_tar --format=m4_if([$1], [pax], [posix], [$1]) -chf - "'"$tardir"' |
|
||||||
am__untar="$_am_tar -xf -" |
|
||||||
;; |
|
||||||
plaintar) |
|
||||||
# Must skip GNU tar: if it does not support --format= it doesn't create |
|
||||||
# ustar tarball either. |
|
||||||
(tar --version) >/dev/null 2>&1 && continue |
|
||||||
am__tar='tar chf - "$$tardir"' |
|
||||||
am__tar_='tar chf - "$tardir"' |
|
||||||
am__untar='tar xf -' |
|
||||||
;; |
|
||||||
pax) |
|
||||||
am__tar='pax -L -x $1 -w "$$tardir"' |
|
||||||
am__tar_='pax -L -x $1 -w "$tardir"' |
|
||||||
am__untar='pax -r' |
|
||||||
;; |
|
||||||
cpio) |
|
||||||
am__tar='find "$$tardir" -print | cpio -o -H $1 -L' |
|
||||||
am__tar_='find "$tardir" -print | cpio -o -H $1 -L' |
|
||||||
am__untar='cpio -i -H $1 -d' |
|
||||||
;; |
|
||||||
none) |
|
||||||
am__tar=false |
|
||||||
am__tar_=false |
|
||||||
am__untar=false |
|
||||||
;; |
|
||||||
esac |
|
||||||
|
|
||||||
# If the value was cached, stop now. We just wanted to have am__tar |
|
||||||
# and am__untar set. |
|
||||||
test -n "${am_cv_prog_tar_$1}" && break |
|
||||||
|
|
||||||
# tar/untar a dummy directory, and stop if the command works |
|
||||||
rm -rf conftest.dir |
|
||||||
mkdir conftest.dir |
|
||||||
echo GrepMe > conftest.dir/file |
|
||||||
AM_RUN_LOG([tardir=conftest.dir && eval $am__tar_ >conftest.tar]) |
|
||||||
rm -rf conftest.dir |
|
||||||
if test -s conftest.tar; then |
|
||||||
AM_RUN_LOG([$am__untar <conftest.tar]) |
|
||||||
grep GrepMe conftest.dir/file >/dev/null 2>&1 && break |
|
||||||
fi |
|
||||||
done |
|
||||||
rm -rf conftest.dir |
|
||||||
|
|
||||||
AC_CACHE_VAL([am_cv_prog_tar_$1], [am_cv_prog_tar_$1=$_am_tool]) |
|
||||||
AC_MSG_RESULT([$am_cv_prog_tar_$1])]) |
|
||||||
AC_SUBST([am__tar]) |
|
||||||
AC_SUBST([am__untar]) |
|
||||||
]) # _AM_PROG_TAR |
|
||||||
|
|
||||||
m4_include([m4/custom.m4]) |
|
||||||
m4_include([m4/jni.m4]) |
|
||||||
m4_include([m4/libtool.m4]) |
|
||||||
m4_include([m4/ltoptions.m4]) |
|
||||||
m4_include([m4/ltsugar.m4]) |
|
||||||
m4_include([m4/ltversion.m4]) |
|
||||||
m4_include([m4/lt~obsolete.m4]) |
|
||||||
m4_include([m4/osx-universal.m4]) |
|
@ -1,270 +0,0 @@ |
|||||||
#! /bin/sh |
|
||||||
# Wrapper for Microsoft lib.exe |
|
||||||
|
|
||||||
me=ar-lib |
|
||||||
scriptversion=2012-03-01.08; # UTC |
|
||||||
|
|
||||||
# Copyright (C) 2010-2012 Free Software Foundation, Inc. |
|
||||||
# Written by Peter Rosin <peda@lysator.liu.se>. |
|
||||||
# |
|
||||||
# This program is free software; you can redistribute it and/or modify |
|
||||||
# it under the terms of the GNU General Public License as published by |
|
||||||
# the Free Software Foundation; either version 2, or (at your option) |
|
||||||
# any later version. |
|
||||||
# |
|
||||||
# This program is distributed in the hope that it will be useful, |
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
# GNU General Public License for more details. |
|
||||||
# |
|
||||||
# You should have received a copy of the GNU General Public License |
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
||||||
|
|
||||||
# As a special exception to the GNU General Public License, if you |
|
||||||
# distribute this file as part of a program that contains a |
|
||||||
# configuration script generated by Autoconf, you may include it under |
|
||||||
# the same distribution terms that you use for the rest of that program. |
|
||||||
|
|
||||||
# This file is maintained in Automake, please report |
|
||||||
# bugs to <bug-automake@gnu.org> or send patches to |
|
||||||
# <automake-patches@gnu.org>. |
|
||||||
|
|
||||||
|
|
||||||
# func_error message |
|
||||||
func_error () |
|
||||||
{ |
|
||||||
echo "$me: $1" 1>&2 |
|
||||||
exit 1 |
|
||||||
} |
|
||||||
|
|
||||||
file_conv= |
|
||||||
|
|
||||||
# func_file_conv build_file |
|
||||||
# Convert a $build file to $host form and store it in $file |
|
||||||
# Currently only supports Windows hosts. |
|
||||||
func_file_conv () |
|
||||||
{ |
|
||||||
file=$1 |
|
||||||
case $file in |
|
||||||
/ | /[!/]*) # absolute file, and not a UNC file |
|
||||||
if test -z "$file_conv"; then |
|
||||||
# lazily determine how to convert abs files |
|
||||||
case `uname -s` in |
|
||||||
MINGW*) |
|
||||||
file_conv=mingw |
|
||||||
;; |
|
||||||
CYGWIN*) |
|
||||||
file_conv=cygwin |
|
||||||
;; |
|
||||||
*) |
|
||||||
file_conv=wine |
|
||||||
;; |
|
||||||
esac |
|
||||||
fi |
|
||||||
case $file_conv in |
|
||||||
mingw) |
|
||||||
file=`cmd //C echo "$file " | sed -e 's/"\(.*\) " *$/\1/'` |
|
||||||
;; |
|
||||||
cygwin) |
|
||||||
file=`cygpath -m "$file" || echo "$file"` |
|
||||||
;; |
|
||||||
wine) |
|
||||||
file=`winepath -w "$file" || echo "$file"` |
|
||||||
;; |
|
||||||
esac |
|
||||||
;; |
|
||||||
esac |
|
||||||
} |
|
||||||
|
|
||||||
# func_at_file at_file operation archive |
|
||||||
# Iterate over all members in AT_FILE performing OPERATION on ARCHIVE |
|
||||||
# for each of them. |
|
||||||
# When interpreting the content of the @FILE, do NOT use func_file_conv, |
|
||||||
# since the user would need to supply preconverted file names to |
|
||||||
# binutils ar, at least for MinGW. |
|
||||||
func_at_file () |
|
||||||
{ |
|
||||||
operation=$2 |
|
||||||
archive=$3 |
|
||||||
at_file_contents=`cat "$1"` |
|
||||||
eval set x "$at_file_contents" |
|
||||||
shift |
|
||||||
|
|
||||||
for member |
|
||||||
do |
|
||||||
$AR -NOLOGO $operation:"$member" "$archive" || exit $? |
|
||||||
done |
|
||||||
} |
|
||||||
|
|
||||||
case $1 in |
|
||||||
'') |
|
||||||
func_error "no command. Try '$0 --help' for more information." |
|
||||||
;; |
|
||||||
-h | --h*) |
|
||||||
cat <<EOF |
|
||||||
Usage: $me [--help] [--version] PROGRAM ACTION ARCHIVE [MEMBER...] |
|
||||||
|
|
||||||
Members may be specified in a file named with @FILE. |
|
||||||
EOF |
|
||||||
exit $? |
|
||||||
;; |
|
||||||
-v | --v*) |
|
||||||
echo "$me, version $scriptversion" |
|
||||||
exit $? |
|
||||||
;; |
|
||||||
esac |
|
||||||
|
|
||||||
if test $# -lt 3; then |
|
||||||
func_error "you must specify a program, an action and an archive" |
|
||||||
fi |
|
||||||
|
|
||||||
AR=$1 |
|
||||||
shift |
|
||||||
while : |
|
||||||
do |
|
||||||
if test $# -lt 2; then |
|
||||||
func_error "you must specify a program, an action and an archive" |
|
||||||
fi |
|
||||||
case $1 in |
|
||||||
-lib | -LIB \ |
|
||||||
| -ltcg | -LTCG \ |
|
||||||
| -machine* | -MACHINE* \ |
|
||||||
| -subsystem* | -SUBSYSTEM* \ |
|
||||||
| -verbose | -VERBOSE \ |
|
||||||
| -wx* | -WX* ) |
|
||||||
AR="$AR $1" |
|
||||||
shift |
|
||||||
;; |
|
||||||
*) |
|
||||||
action=$1 |
|
||||||
shift |
|
||||||
break |
|
||||||
;; |
|
||||||
esac |
|
||||||
done |
|
||||||
orig_archive=$1 |
|
||||||
shift |
|
||||||
func_file_conv "$orig_archive" |
|
||||||
archive=$file |
|
||||||
|
|
||||||
# strip leading dash in $action |
|
||||||
action=${action#-} |
|
||||||
|
|
||||||
delete= |
|
||||||
extract= |
|
||||||
list= |
|
||||||
quick= |
|
||||||
replace= |
|
||||||
index= |
|
||||||
create= |
|
||||||
|
|
||||||
while test -n "$action" |
|
||||||
do |
|
||||||
case $action in |
|
||||||
d*) delete=yes ;; |
|
||||||
x*) extract=yes ;; |
|
||||||
t*) list=yes ;; |
|
||||||
q*) quick=yes ;; |
|
||||||
r*) replace=yes ;; |
|
||||||
s*) index=yes ;; |
|
||||||
S*) ;; # the index is always updated implicitly |
|
||||||
c*) create=yes ;; |
|
||||||
u*) ;; # TODO: don't ignore the update modifier |
|
||||||
v*) ;; # TODO: don't ignore the verbose modifier |
|
||||||
*) |
|
||||||
func_error "unknown action specified" |
|
||||||
;; |
|
||||||
esac |
|
||||||
action=${action#?} |
|
||||||
done |
|
||||||
|
|
||||||
case $delete$extract$list$quick$replace,$index in |
|
||||||
yes,* | ,yes) |
|
||||||
;; |
|
||||||
yesyes*) |
|
||||||
func_error "more than one action specified" |
|
||||||
;; |
|
||||||
*) |
|
||||||
func_error "no action specified" |
|
||||||
;; |
|
||||||
esac |
|
||||||
|
|
||||||
if test -n "$delete"; then |
|
||||||
if test ! -f "$orig_archive"; then |
|
||||||
func_error "archive not found" |
|
||||||
fi |
|
||||||
for member |
|
||||||
do |
|
||||||
case $1 in |
|
||||||
@*) |
|
||||||
func_at_file "${1#@}" -REMOVE "$archive" |
|
||||||
;; |
|
||||||
*) |
|
||||||
func_file_conv "$1" |
|
||||||
$AR -NOLOGO -REMOVE:"$file" "$archive" || exit $? |
|
||||||
;; |
|
||||||
esac |
|
||||||
done |
|
||||||
|
|
||||||
elif test -n "$extract"; then |
|
||||||
if test ! -f "$orig_archive"; then |
|
||||||
func_error "archive not found" |
|
||||||
fi |
|
||||||
if test $# -gt 0; then |
|
||||||
for member |
|
||||||
do |
|
||||||
case $1 in |
|
||||||
@*) |
|
||||||
func_at_file "${1#@}" -EXTRACT "$archive" |
|
||||||
;; |
|
||||||
*) |
|
||||||
func_file_conv "$1" |
|
||||||
$AR -NOLOGO -EXTRACT:"$file" "$archive" || exit $? |
|
||||||
;; |
|
||||||
esac |
|
||||||
done |
|
||||||
else |
|
||||||
$AR -NOLOGO -LIST "$archive" | sed -e 's/\\/\\\\/g' | while read member |
|
||||||
do |
|
||||||
$AR -NOLOGO -EXTRACT:"$member" "$archive" || exit $? |
|
||||||
done |
|
||||||
fi |
|
||||||
|
|
||||||
elif test -n "$quick$replace"; then |
|
||||||
if test ! -f "$orig_archive"; then |
|
||||||
if test -z "$create"; then |
|
||||||
echo "$me: creating $orig_archive" |
|
||||||
fi |
|
||||||
orig_archive= |
|
||||||
else |
|
||||||
orig_archive=$archive |
|
||||||
fi |
|
||||||
|
|
||||||
for member |
|
||||||
do |
|
||||||
case $1 in |
|
||||||
@*) |
|
||||||
func_file_conv "${1#@}" |
|
||||||
set x "$@" "@$file" |
|
||||||
;; |
|
||||||
*) |
|
||||||
func_file_conv "$1" |
|
||||||
set x "$@" "$file" |
|
||||||
;; |
|
||||||
esac |
|
||||||
shift |
|
||||||
shift |
|
||||||
done |
|
||||||
|
|
||||||
if test -n "$orig_archive"; then |
|
||||||
$AR -NOLOGO -OUT:"$archive" "$orig_archive" "$@" || exit $? |
|
||||||
else |
|
||||||
$AR -NOLOGO -OUT:"$archive" "$@" || exit $? |
|
||||||
fi |
|
||||||
|
|
||||||
elif test -n "$list"; then |
|
||||||
if test ! -f "$orig_archive"; then |
|
||||||
func_error "archive not found" |
|
||||||
fi |
|
||||||
$AR -NOLOGO -LIST "$archive" || exit $? |
|
||||||
fi |
|
File diff suppressed because it is too large
Load Diff
File diff suppressed because it is too large
Load Diff
@ -1,527 +0,0 @@ |
|||||||
#!/bin/sh |
|
||||||
# install - install a program, script, or datafile |
|
||||||
|
|
||||||
scriptversion=2011-11-20.07; # UTC |
|
||||||
|
|
||||||
# This originates from X11R5 (mit/util/scripts/install.sh), which was |
|
||||||
# later released in X11R6 (xc/config/util/install.sh) with the |
|
||||||
# following copyright and license. |
|
||||||
# |
|
||||||
# Copyright (C) 1994 X Consortium |
|
||||||
# |
|
||||||
# Permission is hereby granted, free of charge, to any person obtaining a copy |
|
||||||
# of this software and associated documentation files (the "Software"), to |
|
||||||
# deal in the Software without restriction, including without limitation the |
|
||||||
# rights to use, copy, modify, merge, publish, distribute, sublicense, and/or |
|
||||||
# sell copies of the Software, and to permit persons to whom the Software is |
|
||||||
# furnished to do so, subject to the following conditions: |
|
||||||
# |
|
||||||
# The above copyright notice and this permission notice shall be included in |
|
||||||
# all copies or substantial portions of the Software. |
|
||||||
# |
|
||||||
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR |
|
||||||
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, |
|
||||||
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE |
|
||||||
# X CONSORTIUM BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN |
|
||||||
# AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNEC- |
|
||||||
# TION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. |
|
||||||
# |
|
||||||
# Except as contained in this notice, the name of the X Consortium shall not |
|
||||||
# be used in advertising or otherwise to promote the sale, use or other deal- |
|
||||||
# ings in this Software without prior written authorization from the X Consor- |
|
||||||
# tium. |
|
||||||
# |
|
||||||
# |
|
||||||
# FSF changes to this file are in the public domain. |
|
||||||
# |
|
||||||
# Calling this script install-sh is preferred over install.sh, to prevent |
|
||||||
# 'make' implicit rules from creating a file called install from it |
|
||||||
# when there is no Makefile. |
|
||||||
# |
|
||||||
# This script is compatible with the BSD install script, but was written |
|
||||||
# from scratch. |
|
||||||
|
|
||||||
nl=' |
|
||||||
' |
|
||||||
IFS=" "" $nl" |
|
||||||
|
|
||||||
# set DOITPROG to echo to test this script |
|
||||||
|
|
||||||
# Don't use :- since 4.3BSD and earlier shells don't like it. |
|
||||||
doit=${DOITPROG-} |
|
||||||
if test -z "$doit"; then |
|
||||||
doit_exec=exec |
|
||||||
else |
|
||||||
doit_exec=$doit |
|
||||||
fi |
|
||||||
|
|
||||||
# Put in absolute file names if you don't have them in your path; |
|
||||||
# or use environment vars. |
|
||||||
|
|
||||||
chgrpprog=${CHGRPPROG-chgrp} |
|
||||||
chmodprog=${CHMODPROG-chmod} |
|
||||||
chownprog=${CHOWNPROG-chown} |
|
||||||
cmpprog=${CMPPROG-cmp} |
|
||||||
cpprog=${CPPROG-cp} |
|
||||||
mkdirprog=${MKDIRPROG-mkdir} |
|
||||||
mvprog=${MVPROG-mv} |
|
||||||
rmprog=${RMPROG-rm} |
|
||||||
stripprog=${STRIPPROG-strip} |
|
||||||
|
|
||||||
posix_glob='?' |
|
||||||
initialize_posix_glob=' |
|
||||||
test "$posix_glob" != "?" || { |
|
||||||
if (set -f) 2>/dev/null; then |
|
||||||
posix_glob= |
|
||||||
else |
|
||||||
posix_glob=: |
|
||||||
fi |
|
||||||
} |
|
||||||
' |
|
||||||
|
|
||||||
posix_mkdir= |
|
||||||
|
|
||||||
# Desired mode of installed file. |
|
||||||
mode=0755 |
|
||||||
|
|
||||||
chgrpcmd= |
|
||||||
chmodcmd=$chmodprog |
|
||||||
chowncmd= |
|
||||||
mvcmd=$mvprog |
|
||||||
rmcmd="$rmprog -f" |
|
||||||
stripcmd= |
|
||||||
|
|
||||||
src= |
|
||||||
dst= |
|
||||||
dir_arg= |
|
||||||
dst_arg= |
|
||||||
|
|
||||||
copy_on_change=false |
|
||||||
no_target_directory= |
|
||||||
|
|
||||||
usage="\ |
|
||||||
Usage: $0 [OPTION]... [-T] SRCFILE DSTFILE |
|
||||||
or: $0 [OPTION]... SRCFILES... DIRECTORY |
|
||||||
or: $0 [OPTION]... -t DIRECTORY SRCFILES... |
|
||||||
or: $0 [OPTION]... -d DIRECTORIES... |
|
||||||
|
|
||||||
In the 1st form, copy SRCFILE to DSTFILE. |
|
||||||
In the 2nd and 3rd, copy all SRCFILES to DIRECTORY. |
|
||||||
In the 4th, create DIRECTORIES. |
|
||||||
|
|
||||||
Options: |
|
||||||
--help display this help and exit. |
|
||||||
--version display version info and exit. |
|
||||||
|
|
||||||
-c (ignored) |
|
||||||
-C install only if different (preserve the last data modification time) |
|
||||||
-d create directories instead of installing files. |
|
||||||
-g GROUP $chgrpprog installed files to GROUP. |
|
||||||
-m MODE $chmodprog installed files to MODE. |
|
||||||
-o USER $chownprog installed files to USER. |
|
||||||
-s $stripprog installed files. |
|
||||||
-t DIRECTORY install into DIRECTORY. |
|
||||||
-T report an error if DSTFILE is a directory. |
|
||||||
|
|
||||||
Environment variables override the default commands: |
|
||||||
CHGRPPROG CHMODPROG CHOWNPROG CMPPROG CPPROG MKDIRPROG MVPROG |
|
||||||
RMPROG STRIPPROG |
|
||||||
" |
|
||||||
|
|
||||||
while test $# -ne 0; do |
|
||||||
case $1 in |
|
||||||
-c) ;; |
|
||||||
|
|
||||||
-C) copy_on_change=true;; |
|
||||||
|
|
||||||
-d) dir_arg=true;; |
|
||||||
|
|
||||||
-g) chgrpcmd="$chgrpprog $2" |
|
||||||
shift;; |
|
||||||
|
|
||||||
--help) echo "$usage"; exit $?;; |
|
||||||
|
|
||||||
-m) mode=$2 |
|
||||||
case $mode in |
|
||||||
*' '* | *' '* | *' |
|
||||||
'* | *'*'* | *'?'* | *'['*) |
|
||||||
echo "$0: invalid mode: $mode" >&2 |
|
||||||
exit 1;; |
|
||||||
esac |
|
||||||
shift;; |
|
||||||
|
|
||||||
-o) chowncmd="$chownprog $2" |
|
||||||
shift;; |
|
||||||
|
|
||||||
-s) stripcmd=$stripprog;; |
|
||||||
|
|
||||||
-t) dst_arg=$2 |
|
||||||
# Protect names problematic for 'test' and other utilities. |
|
||||||
case $dst_arg in |
|
||||||
-* | [=\(\)!]) dst_arg=./$dst_arg;; |
|
||||||
esac |
|
||||||
shift;; |
|
||||||
|
|
||||||
-T) no_target_directory=true;; |
|
||||||
|
|
||||||
--version) echo "$0 $scriptversion"; exit $?;; |
|
||||||
|
|
||||||
--) shift |
|
||||||
break;; |
|
||||||
|
|
||||||
-*) echo "$0: invalid option: $1" >&2 |
|
||||||
exit 1;; |
|
||||||
|
|
||||||
*) break;; |
|
||||||
esac |
|
||||||
shift |
|
||||||
done |
|
||||||
|
|
||||||
if test $# -ne 0 && test -z "$dir_arg$dst_arg"; then |
|
||||||
# When -d is used, all remaining arguments are directories to create. |
|
||||||
# When -t is used, the destination is already specified. |
|
||||||
# Otherwise, the last argument is the destination. Remove it from $@. |
|
||||||
for arg |
|
||||||
do |
|
||||||
if test -n "$dst_arg"; then |
|
||||||
# $@ is not empty: it contains at least $arg. |
|
||||||
set fnord "$@" "$dst_arg" |
|
||||||
shift # fnord |
|
||||||
fi |
|
||||||
shift # arg |
|
||||||
dst_arg=$arg |
|
||||||
# Protect names problematic for 'test' and other utilities. |
|
||||||
case $dst_arg in |
|
||||||
-* | [=\(\)!]) dst_arg=./$dst_arg;; |
|
||||||
esac |
|
||||||
done |
|
||||||
fi |
|
||||||
|
|
||||||
if test $# -eq 0; then |
|
||||||
if test -z "$dir_arg"; then |
|
||||||
echo "$0: no input file specified." >&2 |
|
||||||
exit 1 |
|
||||||
fi |
|
||||||
# It's OK to call 'install-sh -d' without argument. |
|
||||||
# This can happen when creating conditional directories. |
|
||||||
exit 0 |
|
||||||
fi |
|
||||||
|
|
||||||
if test -z "$dir_arg"; then |
|
||||||
do_exit='(exit $ret); exit $ret' |
|
||||||
trap "ret=129; $do_exit" 1 |
|
||||||
trap "ret=130; $do_exit" 2 |
|
||||||
trap "ret=141; $do_exit" 13 |
|
||||||
trap "ret=143; $do_exit" 15 |
|
||||||
|
|
||||||
# Set umask so as not to create temps with too-generous modes. |
|
||||||
# However, 'strip' requires both read and write access to temps. |
|
||||||
case $mode in |
|
||||||
# Optimize common cases. |
|
||||||
*644) cp_umask=133;; |
|
||||||
*755) cp_umask=22;; |
|
||||||
|
|
||||||
*[0-7]) |
|
||||||
if test -z "$stripcmd"; then |
|
||||||
u_plus_rw= |
|
||||||
else |
|
||||||
u_plus_rw='% 200' |
|
||||||
fi |
|
||||||
cp_umask=`expr '(' 777 - $mode % 1000 ')' $u_plus_rw`;; |
|
||||||
*) |
|
||||||
if test -z "$stripcmd"; then |
|
||||||
u_plus_rw= |
|
||||||
else |
|
||||||
u_plus_rw=,u+rw |
|
||||||
fi |
|
||||||
cp_umask=$mode$u_plus_rw;; |
|
||||||
esac |
|
||||||
fi |
|
||||||
|
|
||||||
for src |
|
||||||
do |
|
||||||
# Protect names problematic for 'test' and other utilities. |
|
||||||
case $src in |
|
||||||
-* | [=\(\)!]) src=./$src;; |
|
||||||
esac |
|
||||||
|
|
||||||
if test -n "$dir_arg"; then |
|
||||||
dst=$src |
|
||||||
dstdir=$dst |
|
||||||
test -d "$dstdir" |
|
||||||
dstdir_status=$? |
|
||||||
else |
|
||||||
|
|
||||||
# Waiting for this to be detected by the "$cpprog $src $dsttmp" command |
|
||||||
# might cause directories to be created, which would be especially bad |
|
||||||
# if $src (and thus $dsttmp) contains '*'. |
|
||||||
if test ! -f "$src" && test ! -d "$src"; then |
|
||||||
echo "$0: $src does not exist." >&2 |
|
||||||
exit 1 |
|
||||||
fi |
|
||||||
|
|
||||||
if test -z "$dst_arg"; then |
|
||||||
echo "$0: no destination specified." >&2 |
|
||||||
exit 1 |
|
||||||
fi |
|
||||||
dst=$dst_arg |
|
||||||
|
|
||||||
# If destination is a directory, append the input filename; won't work |
|
||||||
# if double slashes aren't ignored. |
|
||||||
if test -d "$dst"; then |
|
||||||
if test -n "$no_target_directory"; then |
|
||||||
echo "$0: $dst_arg: Is a directory" >&2 |
|
||||||
exit 1 |
|
||||||
fi |
|
||||||
dstdir=$dst |
|
||||||
dst=$dstdir/`basename "$src"` |
|
||||||
dstdir_status=0 |
|
||||||
else |
|
||||||
# Prefer dirname, but fall back on a substitute if dirname fails. |
|
||||||
dstdir=` |
|
||||||
(dirname "$dst") 2>/dev/null || |
|
||||||
expr X"$dst" : 'X\(.*[^/]\)//*[^/][^/]*/*$' \| \ |
|
||||||
X"$dst" : 'X\(//\)[^/]' \| \ |
|
||||||
X"$dst" : 'X\(//\)$' \| \ |
|
||||||
X"$dst" : 'X\(/\)' \| . 2>/dev/null || |
|
||||||
echo X"$dst" | |
|
||||||
sed '/^X\(.*[^/]\)\/\/*[^/][^/]*\/*$/{ |
|
||||||
s//\1/ |
|
||||||
q |
|
||||||
} |
|
||||||
/^X\(\/\/\)[^/].*/{ |
|
||||||
s//\1/ |
|
||||||
q |
|
||||||
} |
|
||||||
/^X\(\/\/\)$/{ |
|
||||||
s//\1/ |
|
||||||
q |
|
||||||
} |
|
||||||
/^X\(\/\).*/{ |
|
||||||
s//\1/ |
|
||||||
q |
|
||||||
} |
|
||||||
s/.*/./; q' |
|
||||||
` |
|
||||||
|
|
||||||
test -d "$dstdir" |
|
||||||
dstdir_status=$? |
|
||||||
fi |
|
||||||
fi |
|
||||||
|
|
||||||
obsolete_mkdir_used=false |
|
||||||
|
|
||||||
if test $dstdir_status != 0; then |
|
||||||
case $posix_mkdir in |
|
||||||
'') |
|
||||||
# Create intermediate dirs using mode 755 as modified by the umask. |
|
||||||
# This is like FreeBSD 'install' as of 1997-10-28. |
|
||||||
umask=`umask` |
|
||||||
case $stripcmd.$umask in |
|
||||||
# Optimize common cases. |
|
||||||
*[2367][2367]) mkdir_umask=$umask;; |
|
||||||
.*0[02][02] | .[02][02] | .[02]) mkdir_umask=22;; |
|
||||||
|
|
||||||
*[0-7]) |
|
||||||
mkdir_umask=`expr $umask + 22 \ |
|
||||||
- $umask % 100 % 40 + $umask % 20 \ |
|
||||||
- $umask % 10 % 4 + $umask % 2 |
|
||||||
`;; |
|
||||||
*) mkdir_umask=$umask,go-w;; |
|
||||||
esac |
|
||||||
|
|
||||||
# With -d, create the new directory with the user-specified mode. |
|
||||||
# Otherwise, rely on $mkdir_umask. |
|
||||||
if test -n "$dir_arg"; then |
|
||||||
mkdir_mode=-m$mode |
|
||||||
else |
|
||||||
mkdir_mode= |
|
||||||
fi |
|
||||||
|
|
||||||
posix_mkdir=false |
|
||||||
case $umask in |
|
||||||
*[123567][0-7][0-7]) |
|
||||||
# POSIX mkdir -p sets u+wx bits regardless of umask, which |
|
||||||
# is incompatible with FreeBSD 'install' when (umask & 300) != 0. |
|
||||||
;; |
|
||||||
*) |
|
||||||
tmpdir=${TMPDIR-/tmp}/ins$RANDOM-$$ |
|
||||||
trap 'ret=$?; rmdir "$tmpdir/d" "$tmpdir" 2>/dev/null; exit $ret' 0 |
|
||||||
|
|
||||||
if (umask $mkdir_umask && |
|
||||||
exec $mkdirprog $mkdir_mode -p -- "$tmpdir/d") >/dev/null 2>&1 |
|
||||||
then |
|
||||||
if test -z "$dir_arg" || { |
|
||||||
# Check for POSIX incompatibilities with -m. |
|
||||||
# HP-UX 11.23 and IRIX 6.5 mkdir -m -p sets group- or |
|
||||||
# other-writable bit of parent directory when it shouldn't. |
|
||||||
# FreeBSD 6.1 mkdir -m -p sets mode of existing directory. |
|
||||||
ls_ld_tmpdir=`ls -ld "$tmpdir"` |
|
||||||
case $ls_ld_tmpdir in |
|
||||||
d????-?r-*) different_mode=700;; |
|
||||||
d????-?--*) different_mode=755;; |
|
||||||
*) false;; |
|
||||||
esac && |
|
||||||
$mkdirprog -m$different_mode -p -- "$tmpdir" && { |
|
||||||
ls_ld_tmpdir_1=`ls -ld "$tmpdir"` |
|
||||||
test "$ls_ld_tmpdir" = "$ls_ld_tmpdir_1" |
|
||||||
} |
|
||||||
} |
|
||||||
then posix_mkdir=: |
|
||||||
fi |
|
||||||
rmdir "$tmpdir/d" "$tmpdir" |
|
||||||
else |
|
||||||
# Remove any dirs left behind by ancient mkdir implementations. |
|
||||||
rmdir ./$mkdir_mode ./-p ./-- 2>/dev/null |
|
||||||
fi |
|
||||||
trap '' 0;; |
|
||||||
esac;; |
|
||||||
esac |
|
||||||
|
|
||||||
if |
|
||||||
$posix_mkdir && ( |
|
||||||
umask $mkdir_umask && |
|
||||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir" |
|
||||||
) |
|
||||||
then : |
|
||||||
else |
|
||||||
|
|
||||||
# The umask is ridiculous, or mkdir does not conform to POSIX, |
|
||||||
# or it failed possibly due to a race condition. Create the |
|
||||||
# directory the slow way, step by step, checking for races as we go. |
|
||||||
|
|
||||||
case $dstdir in |
|
||||||
/*) prefix='/';; |
|
||||||
[-=\(\)!]*) prefix='./';; |
|
||||||
*) prefix='';; |
|
||||||
esac |
|
||||||
|
|
||||||
eval "$initialize_posix_glob" |
|
||||||
|
|
||||||
oIFS=$IFS |
|
||||||
IFS=/ |
|
||||||
$posix_glob set -f |
|
||||||
set fnord $dstdir |
|
||||||
shift |
|
||||||
$posix_glob set +f |
|
||||||
IFS=$oIFS |
|
||||||
|
|
||||||
prefixes= |
|
||||||
|
|
||||||
for d |
|
||||||
do |
|
||||||
test X"$d" = X && continue |
|
||||||
|
|
||||||
prefix=$prefix$d |
|
||||||
if test -d "$prefix"; then |
|
||||||
prefixes= |
|
||||||
else |
|
||||||
if $posix_mkdir; then |
|
||||||
(umask=$mkdir_umask && |
|
||||||
$doit_exec $mkdirprog $mkdir_mode -p -- "$dstdir") && break |
|
||||||
# Don't fail if two instances are running concurrently. |
|
||||||
test -d "$prefix" || exit 1 |
|
||||||
else |
|
||||||
case $prefix in |
|
||||||
*\'*) qprefix=`echo "$prefix" | sed "s/'/'\\\\\\\\''/g"`;; |
|
||||||
*) qprefix=$prefix;; |
|
||||||
esac |
|
||||||
prefixes="$prefixes '$qprefix'" |
|
||||||
fi |
|
||||||
fi |
|
||||||
prefix=$prefix/ |
|
||||||
done |
|
||||||
|
|
||||||
if test -n "$prefixes"; then |
|
||||||
# Don't fail if two instances are running concurrently. |
|
||||||
(umask $mkdir_umask && |
|
||||||
eval "\$doit_exec \$mkdirprog $prefixes") || |
|
||||||
test -d "$dstdir" || exit 1 |
|
||||||
obsolete_mkdir_used=true |
|
||||||
fi |
|
||||||
fi |
|
||||||
fi |
|
||||||
|
|
||||||
if test -n "$dir_arg"; then |
|
||||||
{ test -z "$chowncmd" || $doit $chowncmd "$dst"; } && |
|
||||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dst"; } && |
|
||||||
{ test "$obsolete_mkdir_used$chowncmd$chgrpcmd" = false || |
|
||||||
test -z "$chmodcmd" || $doit $chmodcmd $mode "$dst"; } || exit 1 |
|
||||||
else |
|
||||||
|
|
||||||
# Make a couple of temp file names in the proper directory. |
|
||||||
dsttmp=$dstdir/_inst.$$_ |
|
||||||
rmtmp=$dstdir/_rm.$$_ |
|
||||||
|
|
||||||
# Trap to clean up those temp files at exit. |
|
||||||
trap 'ret=$?; rm -f "$dsttmp" "$rmtmp" && exit $ret' 0 |
|
||||||
|
|
||||||
# Copy the file name to the temp name. |
|
||||||
(umask $cp_umask && $doit_exec $cpprog "$src" "$dsttmp") && |
|
||||||
|
|
||||||
# and set any options; do chmod last to preserve setuid bits. |
|
||||||
# |
|
||||||
# If any of these fail, we abort the whole thing. If we want to |
|
||||||
# ignore errors from any of these, just make sure not to ignore |
|
||||||
# errors from the above "$doit $cpprog $src $dsttmp" command. |
|
||||||
# |
|
||||||
{ test -z "$chowncmd" || $doit $chowncmd "$dsttmp"; } && |
|
||||||
{ test -z "$chgrpcmd" || $doit $chgrpcmd "$dsttmp"; } && |
|
||||||
{ test -z "$stripcmd" || $doit $stripcmd "$dsttmp"; } && |
|
||||||
{ test -z "$chmodcmd" || $doit $chmodcmd $mode "$dsttmp"; } && |
|
||||||
|
|
||||||
# If -C, don't bother to copy if it wouldn't change the file. |
|
||||||
if $copy_on_change && |
|
||||||
old=`LC_ALL=C ls -dlL "$dst" 2>/dev/null` && |
|
||||||
new=`LC_ALL=C ls -dlL "$dsttmp" 2>/dev/null` && |
|
||||||
|
|
||||||
eval "$initialize_posix_glob" && |
|
||||||
$posix_glob set -f && |
|
||||||
set X $old && old=:$2:$4:$5:$6 && |
|
||||||
set X $new && new=:$2:$4:$5:$6 && |
|
||||||
$posix_glob set +f && |
|
||||||
|
|
||||||
test "$old" = "$new" && |
|
||||||
$cmpprog "$dst" "$dsttmp" >/dev/null 2>&1 |
|
||||||
then |
|
||||||
rm -f "$dsttmp" |
|
||||||
else |
|
||||||
# Rename the file to the real destination. |
|
||||||
$doit $mvcmd -f "$dsttmp" "$dst" 2>/dev/null || |
|
||||||
|
|
||||||
# The rename failed, perhaps because mv can't rename something else |
|
||||||
# to itself, or perhaps because mv is so ancient that it does not |
|
||||||
# support -f. |
|
||||||
{ |
|
||||||
# Now remove or move aside any old file at destination location. |
|
||||||
# We try this two ways since rm can't unlink itself on some |
|
||||||
# systems and the destination file might be busy for other |
|
||||||
# reasons. In this case, the final cleanup might fail but the new |
|
||||||
# file should still install successfully. |
|
||||||
{ |
|
||||||
test ! -f "$dst" || |
|
||||||
$doit $rmcmd -f "$dst" 2>/dev/null || |
|
||||||
{ $doit $mvcmd -f "$dst" "$rmtmp" 2>/dev/null && |
|
||||||
{ $doit $rmcmd -f "$rmtmp" 2>/dev/null; :; } |
|
||||||
} || |
|
||||||
{ echo "$0: cannot unlink or rename $dst" >&2 |
|
||||||
(exit 1); exit 1 |
|
||||||
} |
|
||||||
} && |
|
||||||
|
|
||||||
# Now rename the file to the real destination. |
|
||||||
$doit $mvcmd "$dsttmp" "$dst" |
|
||||||
} |
|
||||||
fi || exit 1 |
|
||||||
|
|
||||||
trap '' 0 |
|
||||||
fi |
|
||||||
done |
|
||||||
|
|
||||||
# Local variables: |
|
||||||
# eval: (add-hook 'write-file-hooks 'time-stamp) |
|
||||||
# time-stamp-start: "scriptversion=" |
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H" |
|
||||||
# time-stamp-time-zone: "UTC" |
|
||||||
# time-stamp-end: "; # UTC" |
|
||||||
# End: |
|
File diff suppressed because it is too large
Load Diff
@ -1,330 +0,0 @@ |
|||||||
#! /bin/sh |
|
||||||
# Common stub for a few missing GNU programs while installing. |
|
||||||
|
|
||||||
scriptversion=2012-01-06.18; # UTC |
|
||||||
|
|
||||||
# Copyright (C) 1996-2012 Free Software Foundation, Inc. |
|
||||||
# Originally by Fran,cois Pinard <pinard@iro.umontreal.ca>, 1996. |
|
||||||
|
|
||||||
# This program is free software; you can redistribute it and/or modify |
|
||||||
# it under the terms of the GNU General Public License as published by |
|
||||||
# the Free Software Foundation; either version 2, or (at your option) |
|
||||||
# any later version. |
|
||||||
|
|
||||||
# This program is distributed in the hope that it will be useful, |
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of |
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the |
|
||||||
# GNU General Public License for more details. |
|
||||||
|
|
||||||
# You should have received a copy of the GNU General Public License |
|
||||||
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
|
||||||
|
|
||||||
# As a special exception to the GNU General Public License, if you |
|
||||||
# distribute this file as part of a program that contains a |
|
||||||
# configuration script generated by Autoconf, you may include it under |
|
||||||
# the same distribution terms that you use for the rest of that program. |
|
||||||
|
|
||||||
if test $# -eq 0; then |
|
||||||
echo 1>&2 "Try '$0 --help' for more information" |
|
||||||
exit 1 |
|
||||||
fi |
|
||||||
|
|
||||||
run=: |
|
||||||
sed_output='s/.* --output[ =]\([^ ]*\).*/\1/p' |
|
||||||
sed_minuso='s/.* -o \([^ ]*\).*/\1/p' |
|
||||||
|
|
||||||
# In the cases where this matters, 'missing' is being run in the |
|
||||||
# srcdir already. |
|
||||||
if test -f configure.ac; then |
|
||||||
configure_ac=configure.ac |
|
||||||
else |
|
||||||
configure_ac=configure.in |
|
||||||
fi |
|
||||||
|
|
||||||
msg="missing on your system" |
|
||||||
|
|
||||||
case $1 in |
|
||||||
--run) |
|
||||||
# Try to run requested program, and just exit if it succeeds. |
|
||||||
run= |
|
||||||
shift |
|
||||||
"$@" && exit 0 |
|
||||||
# Exit code 63 means version mismatch. This often happens |
|
||||||
# when the user try to use an ancient version of a tool on |
|
||||||
# a file that requires a minimum version. In this case we |
|
||||||
# we should proceed has if the program had been absent, or |
|
||||||
# if --run hadn't been passed. |
|
||||||
if test $? = 63; then |
|
||||||
run=: |
|
||||||
msg="probably too old" |
|
||||||
fi |
|
||||||
;; |
|
||||||
|
|
||||||
-h|--h|--he|--hel|--help) |
|
||||||
echo "\ |
|
||||||
$0 [OPTION]... PROGRAM [ARGUMENT]... |
|
||||||
|
|
||||||
Handle 'PROGRAM [ARGUMENT]...' for when PROGRAM is missing, or return an |
|
||||||
error status if there is no known handling for PROGRAM. |
|
||||||
|
|
||||||
Options: |
|
||||||
-h, --help display this help and exit |
|
||||||
-v, --version output version information and exit |
|
||||||
--run try to run the given command, and emulate it if it fails |
|
||||||
|
|
||||||
Supported PROGRAM values: |
|
||||||
aclocal touch file 'aclocal.m4' |
|
||||||
autoconf touch file 'configure' |
|
||||||
autoheader touch file 'config.h.in' |
|
||||||
autom4te touch the output file, or create a stub one |
|
||||||
automake touch all 'Makefile.in' files |
|
||||||
bison create 'y.tab.[ch]', if possible, from existing .[ch] |
|
||||||
flex create 'lex.yy.c', if possible, from existing .c |
|
||||||
help2man touch the output file |
|
||||||
lex create 'lex.yy.c', if possible, from existing .c |
|
||||||
makeinfo touch the output file |
|
||||||
yacc create 'y.tab.[ch]', if possible, from existing .[ch] |
|
||||||
|
|
||||||
Version suffixes to PROGRAM as well as the prefixes 'gnu-', 'gnu', and |
|
||||||
'g' are ignored when checking the name. |
|
||||||
|
|
||||||
Send bug reports to <bug-automake@gnu.org>." |
|
||||||
exit $? |
|
||||||
;; |
|
||||||
|
|
||||||
-v|--v|--ve|--ver|--vers|--versi|--versio|--version) |
|
||||||
echo "missing $scriptversion (GNU Automake)" |
|
||||||
exit $? |
|
||||||
;; |
|
||||||
|
|
||||||
-*) |
|
||||||
echo 1>&2 "$0: Unknown '$1' option" |
|
||||||
echo 1>&2 "Try '$0 --help' for more information" |
|
||||||
exit 1 |
|
||||||
;; |
|
||||||
|
|
||||||
esac |
|
||||||
|
|
||||||
# normalize program name to check for. |
|
||||||
program=`echo "$1" | sed ' |
|
||||||
s/^gnu-//; t |
|
||||||
s/^gnu//; t |
|
||||||
s/^g//; t'` |
|
||||||
|
|
||||||
# Now exit if we have it, but it failed. Also exit now if we |
|
||||||
# don't have it and --version was passed (most likely to detect |
|
||||||
# the program). This is about non-GNU programs, so use $1 not |
|
||||||
# $program. |
|
||||||
case $1 in |
|
||||||
lex*|yacc*) |
|
||||||
# Not GNU programs, they don't have --version. |
|
||||||
;; |
|
||||||
|
|
||||||
*) |
|
||||||
if test -z "$run" && ($1 --version) > /dev/null 2>&1; then |
|
||||||
# We have it, but it failed. |
|
||||||
exit 1 |
|
||||||
elif test "x$2" = "x--version" || test "x$2" = "x--help"; then |
|
||||||
# Could not run --version or --help. This is probably someone |
|
||||||
# running '$TOOL --version' or '$TOOL --help' to check whether |
|
||||||
# $TOOL exists and not knowing $TOOL uses missing. |
|
||||||
exit 1 |
|
||||||
fi |
|
||||||
;; |
|
||||||
esac |
|
||||||
|
|
||||||
# If it does not exist, or fails to run (possibly an outdated version), |
|
||||||
# try to emulate it. |
|
||||||
case $program in |
|
||||||
aclocal*) |
|
||||||
echo 1>&2 "\ |
|
||||||
WARNING: '$1' is $msg. You should only need it if |
|
||||||
you modified 'acinclude.m4' or '${configure_ac}'. You might want |
|
||||||
to install the Automake and Perl packages. Grab them from |
|
||||||
any GNU archive site." |
|
||||||
touch aclocal.m4 |
|
||||||
;; |
|
||||||
|
|
||||||
autoconf*) |
|
||||||
echo 1>&2 "\ |
|
||||||
WARNING: '$1' is $msg. You should only need it if |
|
||||||
you modified '${configure_ac}'. You might want to install the |
|
||||||
Autoconf and GNU m4 packages. Grab them from any GNU |
|
||||||
archive site." |
|
||||||
touch configure |
|
||||||
;; |
|
||||||
|
|
||||||
autoheader*) |
|
||||||
echo 1>&2 "\ |
|
||||||
WARNING: '$1' is $msg. You should only need it if |
|
||||||
you modified 'acconfig.h' or '${configure_ac}'. You might want |
|
||||||
to install the Autoconf and GNU m4 packages. Grab them |
|
||||||
from any GNU archive site." |
|
||||||
files=`sed -n 's/^[ ]*A[CM]_CONFIG_HEADER(\([^)]*\)).*/\1/p' ${configure_ac}` |
|
||||||
test -z "$files" && files="config.h" |
|
||||||
touch_files= |
|
||||||
for f in $files; do |
|
||||||
case $f in |
|
||||||
*:*) touch_files="$touch_files "`echo "$f" | |
|
||||||
sed -e 's/^[^:]*://' -e 's/:.*//'`;; |
|
||||||
*) touch_files="$touch_files $f.in";; |
|
||||||
esac |
|
||||||
done |
|
||||||
touch $touch_files |
|
||||||
;; |
|
||||||
|
|
||||||
automake*) |
|
||||||
echo 1>&2 "\ |
|
||||||
WARNING: '$1' is $msg. You should only need it if |
|
||||||
you modified 'Makefile.am', 'acinclude.m4' or '${configure_ac}'. |
|
||||||
You might want to install the Automake and Perl packages. |
|
||||||
Grab them from any GNU archive site." |
|
||||||
find . -type f -name Makefile.am -print | |
|
||||||
sed 's/\.am$/.in/' | |
|
||||||
while read f; do touch "$f"; done |
|
||||||
;; |
|
||||||
|
|
||||||
autom4te*) |
|
||||||
echo 1>&2 "\ |
|
||||||
WARNING: '$1' is needed, but is $msg. |
|
||||||
You might have modified some files without having the |
|
||||||
proper tools for further handling them. |
|
||||||
You can get '$1' as part of Autoconf from any GNU |
|
||||||
archive site." |
|
||||||
|
|
||||||
file=`echo "$*" | sed -n "$sed_output"` |
|
||||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` |
|
||||||
if test -f "$file"; then |
|
||||||
touch $file |
|
||||||
else |
|
||||||
test -z "$file" || exec >$file |
|
||||||
echo "#! /bin/sh" |
|
||||||
echo "# Created by GNU Automake missing as a replacement of" |
|
||||||
echo "# $ $@" |
|
||||||
echo "exit 0" |
|
||||||
chmod +x $file |
|
||||||
exit 1 |
|
||||||
fi |
|
||||||
;; |
|
||||||
|
|
||||||
bison*|yacc*) |
|
||||||
echo 1>&2 "\ |
|
||||||
WARNING: '$1' $msg. You should only need it if |
|
||||||
you modified a '.y' file. You may need the Bison package |
|
||||||
in order for those modifications to take effect. You can get |
|
||||||
Bison from any GNU archive site." |
|
||||||
rm -f y.tab.c y.tab.h |
|
||||||
if test $# -ne 1; then |
|
||||||
eval LASTARG=\${$#} |
|
||||||
case $LASTARG in |
|
||||||
*.y) |
|
||||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/c/'` |
|
||||||
if test -f "$SRCFILE"; then |
|
||||||
cp "$SRCFILE" y.tab.c |
|
||||||
fi |
|
||||||
SRCFILE=`echo "$LASTARG" | sed 's/y$/h/'` |
|
||||||
if test -f "$SRCFILE"; then |
|
||||||
cp "$SRCFILE" y.tab.h |
|
||||||
fi |
|
||||||
;; |
|
||||||
esac |
|
||||||
fi |
|
||||||
if test ! -f y.tab.h; then |
|
||||||
echo >y.tab.h |
|
||||||
fi |
|
||||||
if test ! -f y.tab.c; then |
|
||||||
echo 'main() { return 0; }' >y.tab.c |
|
||||||
fi |
|
||||||
;; |
|
||||||
|
|
||||||
lex*|flex*) |
|
||||||
echo 1>&2 "\ |
|
||||||
WARNING: '$1' is $msg. You should only need it if |
|
||||||
you modified a '.l' file. You may need the Flex package |
|
||||||
in order for those modifications to take effect. You can get |
|
||||||
Flex from any GNU archive site." |
|
||||||
rm -f lex.yy.c |
|
||||||
if test $# -ne 1; then |
|
||||||
eval LASTARG=\${$#} |
|
||||||
case $LASTARG in |
|
||||||
*.l) |
|
||||||
SRCFILE=`echo "$LASTARG" | sed 's/l$/c/'` |
|
||||||
if test -f "$SRCFILE"; then |
|
||||||
cp "$SRCFILE" lex.yy.c |
|
||||||
fi |
|
||||||
;; |
|
||||||
esac |
|
||||||
fi |
|
||||||
if test ! -f lex.yy.c; then |
|
||||||
echo 'main() { return 0; }' >lex.yy.c |
|
||||||
fi |
|
||||||
;; |
|
||||||
|
|
||||||
help2man*) |
|
||||||
echo 1>&2 "\ |
|
||||||
WARNING: '$1' is $msg. You should only need it if |
|
||||||
you modified a dependency of a manual page. You may need the |
|
||||||
Help2man package in order for those modifications to take |
|
||||||
effect. You can get Help2man from any GNU archive site." |
|
||||||
|
|
||||||
file=`echo "$*" | sed -n "$sed_output"` |
|
||||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` |
|
||||||
if test -f "$file"; then |
|
||||||
touch $file |
|
||||||
else |
|
||||||
test -z "$file" || exec >$file |
|
||||||
echo ".ab help2man is required to generate this page" |
|
||||||
exit $? |
|
||||||
fi |
|
||||||
;; |
|
||||||
|
|
||||||
makeinfo*) |
|
||||||
echo 1>&2 "\ |
|
||||||
WARNING: '$1' is $msg. You should only need it if |
|
||||||
you modified a '.texi' or '.texinfo' file, or any other file |
|
||||||
indirectly affecting the aspect of the manual. The spurious |
|
||||||
call might also be the consequence of using a buggy 'make' (AIX, |
|
||||||
DU, IRIX). You might want to install the Texinfo package or |
|
||||||
the GNU make package. Grab either from any GNU archive site." |
|
||||||
# The file to touch is that specified with -o ... |
|
||||||
file=`echo "$*" | sed -n "$sed_output"` |
|
||||||
test -z "$file" && file=`echo "$*" | sed -n "$sed_minuso"` |
|
||||||
if test -z "$file"; then |
|
||||||
# ... or it is the one specified with @setfilename ... |
|
||||||
infile=`echo "$*" | sed 's/.* \([^ ]*\) *$/\1/'` |
|
||||||
file=`sed -n ' |
|
||||||
/^@setfilename/{ |
|
||||||
s/.* \([^ ]*\) *$/\1/ |
|
||||||
p |
|
||||||
q |
|
||||||
}' $infile` |
|
||||||
# ... or it is derived from the source name (dir/f.texi becomes f.info) |
|
||||||
test -z "$file" && file=`echo "$infile" | sed 's,.*/,,;s,.[^.]*$,,'`.info |
|
||||||
fi |
|
||||||
# If the file does not exist, the user really needs makeinfo; |
|
||||||
# let's fail without touching anything. |
|
||||||
test -f $file || exit 1 |
|
||||||
touch $file |
|
||||||
;; |
|
||||||
|
|
||||||
*) |
|
||||||
echo 1>&2 "\ |
|
||||||
WARNING: '$1' is needed, and is $msg. |
|
||||||
You might have modified some files without having the |
|
||||||
proper tools for further handling them. Check the 'README' file, |
|
||||||
it often tells you about the needed prerequisites for installing |
|
||||||
this package. You may also peek at any GNU archive site, in case |
|
||||||
some other package would contain this missing '$1' program." |
|
||||||
exit 1 |
|
||||||
;; |
|
||||||
esac |
|
||||||
|
|
||||||
exit 0 |
|
||||||
|
|
||||||
# Local variables: |
|
||||||
# eval: (add-hook 'write-file-hooks 'time-stamp) |
|
||||||
# time-stamp-start: "scriptversion=" |
|
||||||
# time-stamp-format: "%:y-%02m-%02d.%02H" |
|
||||||
# time-stamp-time-zone: "UTC" |
|
||||||
# time-stamp-end: "; # UTC" |
|
||||||
# End: |
|
File diff suppressed because it is too large
Load Diff
@ -1,27 +0,0 @@ |
|||||||
Copyright (c) 2011 FuseSource Corp. All rights reserved. |
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without |
|
||||||
modification, are permitted provided that the following conditions are |
|
||||||
met: |
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright |
|
||||||
notice, this list of conditions and the following disclaimer. |
|
||||||
* 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. |
|
||||||
* Neither the name of FuseSource Corp. nor the names of its |
|
||||||
contributors may be used to endorse or promote products derived from |
|
||||||
this software without specific prior written permission. |
|
||||||
|
|
||||||
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. |
|
@ -1,63 +0,0 @@ |
|||||||
dnl --------------------------------------------------------------------------- |
|
||||||
dnl Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
dnl |
|
||||||
dnl http://fusesource.com |
|
||||||
dnl |
|
||||||
dnl Redistribution and use in source and binary forms, with or without |
|
||||||
dnl modification, are permitted provided that the following conditions are |
|
||||||
dnl met: |
|
||||||
dnl |
|
||||||
dnl * Redistributions of source code must retain the above copyright |
|
||||||
dnl notice, this list of conditions and the following disclaimer. |
|
||||||
dnl * Redistributions in binary form must reproduce the above |
|
||||||
dnl copyright notice, this list of conditions and the following disclaimer |
|
||||||
dnl in the documentation and/or other materials provided with the |
|
||||||
dnl distribution. |
|
||||||
dnl * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
dnl contributors may be used to endorse or promote products derived from |
|
||||||
dnl this software without specific prior written permission. |
|
||||||
dnl |
|
||||||
dnl THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
|
||||||
dnl "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT |
|
||||||
dnl LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR |
|
||||||
dnl A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT |
|
||||||
dnl OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, |
|
||||||
dnl SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT |
|
||||||
dnl LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, |
|
||||||
dnl DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY |
|
||||||
dnl THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT |
|
||||||
dnl (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE |
|
||||||
dnl OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. |
|
||||||
dnl --------------------------------------------------------------------------- |
|
||||||
|
|
||||||
AC_DEFUN([CUSTOM_M4_SETUP], |
|
||||||
[ |
|
||||||
AC_LANG_PUSH(C++) |
|
||||||
|
|
||||||
AC_CHECK_HEADER([pthread.h],[AC_DEFINE([HAVE_PTHREAD_H], [1], [Define to 1 if you have the <pthread.h> header file.])]) |
|
||||||
|
|
||||||
AC_ARG_WITH([leveldb], |
|
||||||
[AS_HELP_STRING([--with-leveldb@<:@=PATH@:>@], |
|
||||||
[Directory where leveldb was built. Example: --with-leveldb=/opt/leveldb])], |
|
||||||
[ |
|
||||||
CFLAGS="$CFLAGS -I${withval}/include" |
|
||||||
CXXFLAGS="$CXXFLAGS -I${withval}/include" |
|
||||||
AC_SUBST(CXXFLAGS) |
|
||||||
LDFLAGS="$LDFLAGS -lleveldb -L${withval}" |
|
||||||
AC_SUBST(LDFLAGS) |
|
||||||
]) |
|
||||||
|
|
||||||
AC_CHECK_HEADER([leveldb/db.h],,AC_MSG_ERROR([cannot find headers for leveldb])) |
|
||||||
|
|
||||||
AC_ARG_WITH([snappy], |
|
||||||
[AS_HELP_STRING([--with-snappy@<:@=PATH@:>@], |
|
||||||
[Directory where snappy was built. Example: --with-snappy=/opt/snappy])], |
|
||||||
[ |
|
||||||
LDFLAGS="$LDFLAGS -lsnappy -L${withval}" |
|
||||||
AC_SUBST(LDFLAGS) |
|
||||||
]) |
|
||||||
|
|
||||||
AC_CHECK_HEADER([sys/errno.h],[AC_DEFINE([HAVE_SYS_ERRNO_H], [1], [Define to 1 if you have the <sys/errno.h> header file.])]) |
|
||||||
|
|
||||||
AC_LANG_POP() |
|
||||||
]) |
|
@ -1,156 +0,0 @@ |
|||||||
dnl --------------------------------------------------------------------------- |
|
||||||
dnl Copyright (C) 2009-2011 FuseSource Corp. |
|
||||||
dnl http://fusesource.com |
|
||||||
dnl |
|
||||||
dnl Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
dnl you may not use this file except in compliance with the License. |
|
||||||
dnl You may obtain a copy of the License at |
|
||||||
dnl |
|
||||||
dnl http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
dnl |
|
||||||
dnl Unless required by applicable law or agreed to in writing, software |
|
||||||
dnl distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
dnl See the License for the specific language governing permissions and |
|
||||||
dnl limitations under the License. |
|
||||||
dnl --------------------------------------------------------------------------- |
|
||||||
dnl --------------------------------------------------------------------------- |
|
||||||
dnl SYNOPSIS: |
|
||||||
dnl |
|
||||||
dnl WITH_JNI_JDK() |
|
||||||
dnl |
|
||||||
dnl Adds the --with-jni-jdk=PATH option. If not provided, it searches |
|
||||||
dnl for the JDK in the default OS locations. |
|
||||||
dnl |
|
||||||
dnl This macro calls: |
|
||||||
dnl AC_SUBST(JNI_JDK) |
|
||||||
dnl AC_SUBST(JNI_EXTRA_CFLAGS) |
|
||||||
dnl AC_SUBST(JNI_EXTRA_LDFLAGS) |
|
||||||
dnl |
|
||||||
dnl AUTHOR: <a href="http://hiramchirino.com">Hiram Chrino</a> |
|
||||||
dnl --------------------------------------------------------------------------- |
|
||||||
|
|
||||||
AC_DEFUN([WITH_JNI_JDK], |
|
||||||
[ |
|
||||||
AC_PREREQ([2.61]) |
|
||||||
AC_ARG_WITH(jni-jdk, |
|
||||||
[AS_HELP_STRING([--with-jni-jdk=PATH], |
|
||||||
[Location of the Java Development Kit. Defaults to your JAVA_HOME setting and falls back to where it is typically installed on your OS])], |
|
||||||
[ |
|
||||||
if test "$withval" = "no" || test "$withval" = "yes"; then |
|
||||||
AC_MSG_ERROR([--with-jni-jdk: PATH to JDK not supplied]) |
|
||||||
fi |
|
||||||
CHECK_JNI_JDK([$withval], [], [AC_MSG_ERROR([JDK not found. Invalid --with-jni-jdk PATH])]) |
|
||||||
],[ |
|
||||||
|
|
||||||
if test -n "$JAVA_HOME" ; then |
|
||||||
AC_MSG_NOTICE([JAVA_HOME was set, checking to see if it's a JDK we can use...]) |
|
||||||
CHECK_JNI_JDK([$JAVA_HOME], [], []) |
|
||||||
fi |
|
||||||
|
|
||||||
__JNI_GUESS=`which javac` |
|
||||||
AS_IF(test -z "$JNI_JDK" && test -n "$__JNI_GUESS", [ |
|
||||||
AC_MSG_NOTICE([javac was on your path, checking to see if it's part of a JDK we can use...]) |
|
||||||
# transitively resolve the symbolic links to javac |
|
||||||
while file -h "$__JNI_GUESS" 2>/dev/null | grep " symbolic link to " >/dev/null; do |
|
||||||
__JNI_LINK=$( file -h $__JNI_GUESS | sed 's/.*symbolic link to //' | sed "s/'$//" | sed 's/^`//' ) |
|
||||||
__JNI_GUESS=$(cd $(dirname $__JNI_GUESS); cd $(dirname $__JNI_LINK); echo "$(pwd)/$(basename $__JNI_LINK)") |
|
||||||
done |
|
||||||
# move 2 dirs up to the home dir... |
|
||||||
__JNI_GUESS=$(dirname $(dirname $__JNI_GUESS)) |
|
||||||
CHECK_JNI_JDK([$__JNI_GUESS], [], [],[]) |
|
||||||
],[]) |
|
||||||
|
|
||||||
AS_IF(test -z "$JNI_JDK", [ |
|
||||||
case "$host_os" in |
|
||||||
darwin*) __JNI_GUESS="/System/Library/Frameworks/JavaVM.framework";; |
|
||||||
*) __JNI_GUESS="/usr";; |
|
||||||
esac |
|
||||||
AC_MSG_NOTICE([Taking a guess as to where your OS installs the JDK by default...]) |
|
||||||
CHECK_JNI_JDK([$__JNI_GUESS], [], [AC_MSG_ERROR([JDK not found. Please use the --with-jni-jdk option])]) |
|
||||||
],[]) |
|
||||||
]) |
|
||||||
]) |
|
||||||
|
|
||||||
dnl --------------------------------------------------------------------------- |
|
||||||
dnl |
|
||||||
dnl JNI_CHECK_JDK_HOME(PATH, [ACTION-SUCCESS], [ACTION-FAILURE]) |
|
||||||
dnl |
|
||||||
dnl Tests to see if the given path is a valid JDK home location with |
|
||||||
dnl with a JNI headers and library that can be compiled against. |
|
||||||
dnl |
|
||||||
dnl This macro calls: |
|
||||||
dnl |
|
||||||
dnl AC_SUBST(JNI_JDK) |
|
||||||
dnl AC_SUBST(JNI_EXTRA_CFLAGS) |
|
||||||
dnl AC_SUBST(JNI_EXTRA_LDFLAGS) |
|
||||||
dnl |
|
||||||
dnl AUTHOR: <a href="http://hiramchirino.com">Hiram Chrino</a> |
|
||||||
dnl --------------------------------------------------------------------------- |
|
||||||
AC_DEFUN([CHECK_JNI_JDK],[ |
|
||||||
AC_PREREQ([2.61]) |
|
||||||
__JNI_JDK_HOME="$1" |
|
||||||
AC_MSG_CHECKING(if '$__JNI_JDK_HOME' is a JDK) |
|
||||||
# OSX had to be a little different. |
|
||||||
case "$host_os" in |
|
||||||
darwin*) __JNI_INCLUDE="$__JNI_JDK_HOME/Headers";; |
|
||||||
*) __JNI_INCLUDE="$__JNI_JDK_HOME/include";; |
|
||||||
esac |
|
||||||
|
|
||||||
AS_IF(test -r "$__JNI_INCLUDE/jni.h",[ |
|
||||||
|
|
||||||
# Also include the os specific include dirs in the JNI_CFLAGS |
|
||||||
__JNI_CFLAGS="-I$__JNI_INCLUDE" |
|
||||||
case "$host_os" in |
|
||||||
bsdi*) __JNI_INCLUDE_EXTRAS="bsdos";; |
|
||||||
linux*) __JNI_INCLUDE_EXTRAS="linux genunix";; |
|
||||||
osf*) __JNI_INCLUDE_EXTRAS="alpha";; |
|
||||||
solaris*) __JNI_INCLUDE_EXTRAS="solaris";; |
|
||||||
mingw*) __JNI_INCLUDE_EXTRAS="win32";; |
|
||||||
cygwin*) __JNI_INCLUDE_EXTRAS="win32";; |
|
||||||
*) __JNI_INCLUDE_EXTRAS="genunix";; |
|
||||||
esac |
|
||||||
|
|
||||||
for f in $__JNI_INCLUDE_EXTRAS ; do |
|
||||||
if test -d "$__JNI_INCLUDE/$f"; then |
|
||||||
__JNI_CFLAGS="$__JNI_CFLAGS -I$__JNI_INCLUDE/$f" |
|
||||||
fi |
|
||||||
done |
|
||||||
|
|
||||||
saved_CPPFLAGS="$CPPFLAGS" |
|
||||||
CPPFLAGS="$CPPFLAGS $__JNI_CFLAGS" |
|
||||||
JNI_VERSION="1_2" |
|
||||||
AC_LANG_PUSH(C) |
|
||||||
AC_COMPILE_IFELSE( |
|
||||||
[AC_LANG_PROGRAM([[@%:@include <jni.h>]],[[ |
|
||||||
#ifndef JNI_VERSION_$JNI_VERSION |
|
||||||
# error JNI version $JNI_VERSION is not supported. |
|
||||||
#endif |
|
||||||
]]) |
|
||||||
],[ |
|
||||||
|
|
||||||
JNI_JDK=$"$__JNI_JDK_HOME" |
|
||||||
JNI_EXTRA_CFLAGS="$__JNI_CFLAGS" |
|
||||||
AC_SUBST(JNI_JDK) |
|
||||||
AC_SUBST(JNI_EXTRA_CFLAGS) |
|
||||||
case $host_os in |
|
||||||
darwin*) |
|
||||||
JNI_EXTRA_LDFLAGS="-shrext .jnilib -dynamiclib" ;; |
|
||||||
esac |
|
||||||
AC_SUBST(JNI_EXTRA_LDFLAGS) |
|
||||||
|
|
||||||
|
|
||||||
AC_MSG_RESULT([yes]) |
|
||||||
$2 |
|
||||||
],[ |
|
||||||
AC_MSG_RESULT([no]) |
|
||||||
$3 |
|
||||||
]) |
|
||||||
AC_LANG_POP() |
|
||||||
CPPFLAGS="$saved_CPPFLAGS" |
|
||||||
],[ |
|
||||||
AC_MSG_RESULT([no]) |
|
||||||
$3 |
|
||||||
]) |
|
||||||
]) |
|
||||||
|
|
File diff suppressed because it is too large
Load Diff
@ -1,384 +0,0 @@ |
|||||||
# Helper functions for option handling. -*- Autoconf -*- |
|
||||||
# |
|
||||||
# Copyright (C) 2004, 2005, 2007, 2008, 2009 Free Software Foundation, |
|
||||||
# Inc. |
|
||||||
# Written by Gary V. Vaughan, 2004 |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation gives |
|
||||||
# unlimited permission to copy and/or distribute it, with or without |
|
||||||
# modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 7 ltoptions.m4 |
|
||||||
|
|
||||||
# This is to help aclocal find these macros, as it can't see m4_define. |
|
||||||
AC_DEFUN([LTOPTIONS_VERSION], [m4_if([1])]) |
|
||||||
|
|
||||||
|
|
||||||
# _LT_MANGLE_OPTION(MACRO-NAME, OPTION-NAME) |
|
||||||
# ------------------------------------------ |
|
||||||
m4_define([_LT_MANGLE_OPTION], |
|
||||||
[[_LT_OPTION_]m4_bpatsubst($1__$2, [[^a-zA-Z0-9_]], [_])]) |
|
||||||
|
|
||||||
|
|
||||||
# _LT_SET_OPTION(MACRO-NAME, OPTION-NAME) |
|
||||||
# --------------------------------------- |
|
||||||
# Set option OPTION-NAME for macro MACRO-NAME, and if there is a |
|
||||||
# matching handler defined, dispatch to it. Other OPTION-NAMEs are |
|
||||||
# saved as a flag. |
|
||||||
m4_define([_LT_SET_OPTION], |
|
||||||
[m4_define(_LT_MANGLE_OPTION([$1], [$2]))dnl |
|
||||||
m4_ifdef(_LT_MANGLE_DEFUN([$1], [$2]), |
|
||||||
_LT_MANGLE_DEFUN([$1], [$2]), |
|
||||||
[m4_warning([Unknown $1 option `$2'])])[]dnl |
|
||||||
]) |
|
||||||
|
|
||||||
|
|
||||||
# _LT_IF_OPTION(MACRO-NAME, OPTION-NAME, IF-SET, [IF-NOT-SET]) |
|
||||||
# ------------------------------------------------------------ |
|
||||||
# Execute IF-SET if OPTION is set, IF-NOT-SET otherwise. |
|
||||||
m4_define([_LT_IF_OPTION], |
|
||||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], [$2]), [$3], [$4])]) |
|
||||||
|
|
||||||
|
|
||||||
# _LT_UNLESS_OPTIONS(MACRO-NAME, OPTION-LIST, IF-NOT-SET) |
|
||||||
# ------------------------------------------------------- |
|
||||||
# Execute IF-NOT-SET unless all options in OPTION-LIST for MACRO-NAME |
|
||||||
# are set. |
|
||||||
m4_define([_LT_UNLESS_OPTIONS], |
|
||||||
[m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), |
|
||||||
[m4_ifdef(_LT_MANGLE_OPTION([$1], _LT_Option), |
|
||||||
[m4_define([$0_found])])])[]dnl |
|
||||||
m4_ifdef([$0_found], [m4_undefine([$0_found])], [$3 |
|
||||||
])[]dnl |
|
||||||
]) |
|
||||||
|
|
||||||
|
|
||||||
# _LT_SET_OPTIONS(MACRO-NAME, OPTION-LIST) |
|
||||||
# ---------------------------------------- |
|
||||||
# OPTION-LIST is a space-separated list of Libtool options associated |
|
||||||
# with MACRO-NAME. If any OPTION has a matching handler declared with |
|
||||||
# LT_OPTION_DEFINE, dispatch to that macro; otherwise complain about |
|
||||||
# the unknown option and exit. |
|
||||||
m4_defun([_LT_SET_OPTIONS], |
|
||||||
[# Set options |
|
||||||
m4_foreach([_LT_Option], m4_split(m4_normalize([$2])), |
|
||||||
[_LT_SET_OPTION([$1], _LT_Option)]) |
|
||||||
|
|
||||||
m4_if([$1],[LT_INIT],[ |
|
||||||
dnl |
|
||||||
dnl Simply set some default values (i.e off) if boolean options were not |
|
||||||
dnl specified: |
|
||||||
_LT_UNLESS_OPTIONS([LT_INIT], [dlopen], [enable_dlopen=no |
|
||||||
]) |
|
||||||
_LT_UNLESS_OPTIONS([LT_INIT], [win32-dll], [enable_win32_dll=no |
|
||||||
]) |
|
||||||
dnl |
|
||||||
dnl If no reference was made to various pairs of opposing options, then |
|
||||||
dnl we run the default mode handler for the pair. For example, if neither |
|
||||||
dnl `shared' nor `disable-shared' was passed, we enable building of shared |
|
||||||
dnl archives by default: |
|
||||||
_LT_UNLESS_OPTIONS([LT_INIT], [shared disable-shared], [_LT_ENABLE_SHARED]) |
|
||||||
_LT_UNLESS_OPTIONS([LT_INIT], [static disable-static], [_LT_ENABLE_STATIC]) |
|
||||||
_LT_UNLESS_OPTIONS([LT_INIT], [pic-only no-pic], [_LT_WITH_PIC]) |
|
||||||
_LT_UNLESS_OPTIONS([LT_INIT], [fast-install disable-fast-install], |
|
||||||
[_LT_ENABLE_FAST_INSTALL]) |
|
||||||
]) |
|
||||||
])# _LT_SET_OPTIONS |
|
||||||
|
|
||||||
|
|
||||||
## --------------------------------- ## |
|
||||||
## Macros to handle LT_INIT options. ## |
|
||||||
## --------------------------------- ## |
|
||||||
|
|
||||||
# _LT_MANGLE_DEFUN(MACRO-NAME, OPTION-NAME) |
|
||||||
# ----------------------------------------- |
|
||||||
m4_define([_LT_MANGLE_DEFUN], |
|
||||||
[[_LT_OPTION_DEFUN_]m4_bpatsubst(m4_toupper([$1__$2]), [[^A-Z0-9_]], [_])]) |
|
||||||
|
|
||||||
|
|
||||||
# LT_OPTION_DEFINE(MACRO-NAME, OPTION-NAME, CODE) |
|
||||||
# ----------------------------------------------- |
|
||||||
m4_define([LT_OPTION_DEFINE], |
|
||||||
[m4_define(_LT_MANGLE_DEFUN([$1], [$2]), [$3])[]dnl |
|
||||||
])# LT_OPTION_DEFINE |
|
||||||
|
|
||||||
|
|
||||||
# dlopen |
|
||||||
# ------ |
|
||||||
LT_OPTION_DEFINE([LT_INIT], [dlopen], [enable_dlopen=yes |
|
||||||
]) |
|
||||||
|
|
||||||
AU_DEFUN([AC_LIBTOOL_DLOPEN], |
|
||||||
[_LT_SET_OPTION([LT_INIT], [dlopen]) |
|
||||||
AC_DIAGNOSE([obsolete], |
|
||||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you |
|
||||||
put the `dlopen' option into LT_INIT's first parameter.]) |
|
||||||
]) |
|
||||||
|
|
||||||
dnl aclocal-1.4 backwards compatibility: |
|
||||||
dnl AC_DEFUN([AC_LIBTOOL_DLOPEN], []) |
|
||||||
|
|
||||||
|
|
||||||
# win32-dll |
|
||||||
# --------- |
|
||||||
# Declare package support for building win32 dll's. |
|
||||||
LT_OPTION_DEFINE([LT_INIT], [win32-dll], |
|
||||||
[enable_win32_dll=yes |
|
||||||
|
|
||||||
case $host in |
|
||||||
*-*-cygwin* | *-*-mingw* | *-*-pw32* | *-*-cegcc*) |
|
||||||
AC_CHECK_TOOL(AS, as, false) |
|
||||||
AC_CHECK_TOOL(DLLTOOL, dlltool, false) |
|
||||||
AC_CHECK_TOOL(OBJDUMP, objdump, false) |
|
||||||
;; |
|
||||||
esac |
|
||||||
|
|
||||||
test -z "$AS" && AS=as |
|
||||||
_LT_DECL([], [AS], [1], [Assembler program])dnl |
|
||||||
|
|
||||||
test -z "$DLLTOOL" && DLLTOOL=dlltool |
|
||||||
_LT_DECL([], [DLLTOOL], [1], [DLL creation program])dnl |
|
||||||
|
|
||||||
test -z "$OBJDUMP" && OBJDUMP=objdump |
|
||||||
_LT_DECL([], [OBJDUMP], [1], [Object dumper program])dnl |
|
||||||
])# win32-dll |
|
||||||
|
|
||||||
AU_DEFUN([AC_LIBTOOL_WIN32_DLL], |
|
||||||
[AC_REQUIRE([AC_CANONICAL_HOST])dnl |
|
||||||
_LT_SET_OPTION([LT_INIT], [win32-dll]) |
|
||||||
AC_DIAGNOSE([obsolete], |
|
||||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you |
|
||||||
put the `win32-dll' option into LT_INIT's first parameter.]) |
|
||||||
]) |
|
||||||
|
|
||||||
dnl aclocal-1.4 backwards compatibility: |
|
||||||
dnl AC_DEFUN([AC_LIBTOOL_WIN32_DLL], []) |
|
||||||
|
|
||||||
|
|
||||||
# _LT_ENABLE_SHARED([DEFAULT]) |
|
||||||
# ---------------------------- |
|
||||||
# implement the --enable-shared flag, and supports the `shared' and |
|
||||||
# `disable-shared' LT_INIT options. |
|
||||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. |
|
||||||
m4_define([_LT_ENABLE_SHARED], |
|
||||||
[m4_define([_LT_ENABLE_SHARED_DEFAULT], [m4_if($1, no, no, yes)])dnl |
|
||||||
AC_ARG_ENABLE([shared], |
|
||||||
[AS_HELP_STRING([--enable-shared@<:@=PKGS@:>@], |
|
||||||
[build shared libraries @<:@default=]_LT_ENABLE_SHARED_DEFAULT[@:>@])], |
|
||||||
[p=${PACKAGE-default} |
|
||||||
case $enableval in |
|
||||||
yes) enable_shared=yes ;; |
|
||||||
no) enable_shared=no ;; |
|
||||||
*) |
|
||||||
enable_shared=no |
|
||||||
# Look at the argument we got. We use all the common list separators. |
|
||||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," |
|
||||||
for pkg in $enableval; do |
|
||||||
IFS="$lt_save_ifs" |
|
||||||
if test "X$pkg" = "X$p"; then |
|
||||||
enable_shared=yes |
|
||||||
fi |
|
||||||
done |
|
||||||
IFS="$lt_save_ifs" |
|
||||||
;; |
|
||||||
esac], |
|
||||||
[enable_shared=]_LT_ENABLE_SHARED_DEFAULT) |
|
||||||
|
|
||||||
_LT_DECL([build_libtool_libs], [enable_shared], [0], |
|
||||||
[Whether or not to build shared libraries]) |
|
||||||
])# _LT_ENABLE_SHARED |
|
||||||
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [shared], [_LT_ENABLE_SHARED([yes])]) |
|
||||||
LT_OPTION_DEFINE([LT_INIT], [disable-shared], [_LT_ENABLE_SHARED([no])]) |
|
||||||
|
|
||||||
# Old names: |
|
||||||
AC_DEFUN([AC_ENABLE_SHARED], |
|
||||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[shared]) |
|
||||||
]) |
|
||||||
|
|
||||||
AC_DEFUN([AC_DISABLE_SHARED], |
|
||||||
[_LT_SET_OPTION([LT_INIT], [disable-shared]) |
|
||||||
]) |
|
||||||
|
|
||||||
AU_DEFUN([AM_ENABLE_SHARED], [AC_ENABLE_SHARED($@)]) |
|
||||||
AU_DEFUN([AM_DISABLE_SHARED], [AC_DISABLE_SHARED($@)]) |
|
||||||
|
|
||||||
dnl aclocal-1.4 backwards compatibility: |
|
||||||
dnl AC_DEFUN([AM_ENABLE_SHARED], []) |
|
||||||
dnl AC_DEFUN([AM_DISABLE_SHARED], []) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# _LT_ENABLE_STATIC([DEFAULT]) |
|
||||||
# ---------------------------- |
|
||||||
# implement the --enable-static flag, and support the `static' and |
|
||||||
# `disable-static' LT_INIT options. |
|
||||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. |
|
||||||
m4_define([_LT_ENABLE_STATIC], |
|
||||||
[m4_define([_LT_ENABLE_STATIC_DEFAULT], [m4_if($1, no, no, yes)])dnl |
|
||||||
AC_ARG_ENABLE([static], |
|
||||||
[AS_HELP_STRING([--enable-static@<:@=PKGS@:>@], |
|
||||||
[build static libraries @<:@default=]_LT_ENABLE_STATIC_DEFAULT[@:>@])], |
|
||||||
[p=${PACKAGE-default} |
|
||||||
case $enableval in |
|
||||||
yes) enable_static=yes ;; |
|
||||||
no) enable_static=no ;; |
|
||||||
*) |
|
||||||
enable_static=no |
|
||||||
# Look at the argument we got. We use all the common list separators. |
|
||||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," |
|
||||||
for pkg in $enableval; do |
|
||||||
IFS="$lt_save_ifs" |
|
||||||
if test "X$pkg" = "X$p"; then |
|
||||||
enable_static=yes |
|
||||||
fi |
|
||||||
done |
|
||||||
IFS="$lt_save_ifs" |
|
||||||
;; |
|
||||||
esac], |
|
||||||
[enable_static=]_LT_ENABLE_STATIC_DEFAULT) |
|
||||||
|
|
||||||
_LT_DECL([build_old_libs], [enable_static], [0], |
|
||||||
[Whether or not to build static libraries]) |
|
||||||
])# _LT_ENABLE_STATIC |
|
||||||
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [static], [_LT_ENABLE_STATIC([yes])]) |
|
||||||
LT_OPTION_DEFINE([LT_INIT], [disable-static], [_LT_ENABLE_STATIC([no])]) |
|
||||||
|
|
||||||
# Old names: |
|
||||||
AC_DEFUN([AC_ENABLE_STATIC], |
|
||||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[static]) |
|
||||||
]) |
|
||||||
|
|
||||||
AC_DEFUN([AC_DISABLE_STATIC], |
|
||||||
[_LT_SET_OPTION([LT_INIT], [disable-static]) |
|
||||||
]) |
|
||||||
|
|
||||||
AU_DEFUN([AM_ENABLE_STATIC], [AC_ENABLE_STATIC($@)]) |
|
||||||
AU_DEFUN([AM_DISABLE_STATIC], [AC_DISABLE_STATIC($@)]) |
|
||||||
|
|
||||||
dnl aclocal-1.4 backwards compatibility: |
|
||||||
dnl AC_DEFUN([AM_ENABLE_STATIC], []) |
|
||||||
dnl AC_DEFUN([AM_DISABLE_STATIC], []) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# _LT_ENABLE_FAST_INSTALL([DEFAULT]) |
|
||||||
# ---------------------------------- |
|
||||||
# implement the --enable-fast-install flag, and support the `fast-install' |
|
||||||
# and `disable-fast-install' LT_INIT options. |
|
||||||
# DEFAULT is either `yes' or `no'. If omitted, it defaults to `yes'. |
|
||||||
m4_define([_LT_ENABLE_FAST_INSTALL], |
|
||||||
[m4_define([_LT_ENABLE_FAST_INSTALL_DEFAULT], [m4_if($1, no, no, yes)])dnl |
|
||||||
AC_ARG_ENABLE([fast-install], |
|
||||||
[AS_HELP_STRING([--enable-fast-install@<:@=PKGS@:>@], |
|
||||||
[optimize for fast installation @<:@default=]_LT_ENABLE_FAST_INSTALL_DEFAULT[@:>@])], |
|
||||||
[p=${PACKAGE-default} |
|
||||||
case $enableval in |
|
||||||
yes) enable_fast_install=yes ;; |
|
||||||
no) enable_fast_install=no ;; |
|
||||||
*) |
|
||||||
enable_fast_install=no |
|
||||||
# Look at the argument we got. We use all the common list separators. |
|
||||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," |
|
||||||
for pkg in $enableval; do |
|
||||||
IFS="$lt_save_ifs" |
|
||||||
if test "X$pkg" = "X$p"; then |
|
||||||
enable_fast_install=yes |
|
||||||
fi |
|
||||||
done |
|
||||||
IFS="$lt_save_ifs" |
|
||||||
;; |
|
||||||
esac], |
|
||||||
[enable_fast_install=]_LT_ENABLE_FAST_INSTALL_DEFAULT) |
|
||||||
|
|
||||||
_LT_DECL([fast_install], [enable_fast_install], [0], |
|
||||||
[Whether or not to optimize for fast installation])dnl |
|
||||||
])# _LT_ENABLE_FAST_INSTALL |
|
||||||
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [fast-install], [_LT_ENABLE_FAST_INSTALL([yes])]) |
|
||||||
LT_OPTION_DEFINE([LT_INIT], [disable-fast-install], [_LT_ENABLE_FAST_INSTALL([no])]) |
|
||||||
|
|
||||||
# Old names: |
|
||||||
AU_DEFUN([AC_ENABLE_FAST_INSTALL], |
|
||||||
[_LT_SET_OPTION([LT_INIT], m4_if([$1], [no], [disable-])[fast-install]) |
|
||||||
AC_DIAGNOSE([obsolete], |
|
||||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put |
|
||||||
the `fast-install' option into LT_INIT's first parameter.]) |
|
||||||
]) |
|
||||||
|
|
||||||
AU_DEFUN([AC_DISABLE_FAST_INSTALL], |
|
||||||
[_LT_SET_OPTION([LT_INIT], [disable-fast-install]) |
|
||||||
AC_DIAGNOSE([obsolete], |
|
||||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you put |
|
||||||
the `disable-fast-install' option into LT_INIT's first parameter.]) |
|
||||||
]) |
|
||||||
|
|
||||||
dnl aclocal-1.4 backwards compatibility: |
|
||||||
dnl AC_DEFUN([AC_ENABLE_FAST_INSTALL], []) |
|
||||||
dnl AC_DEFUN([AM_DISABLE_FAST_INSTALL], []) |
|
||||||
|
|
||||||
|
|
||||||
# _LT_WITH_PIC([MODE]) |
|
||||||
# -------------------- |
|
||||||
# implement the --with-pic flag, and support the `pic-only' and `no-pic' |
|
||||||
# LT_INIT options. |
|
||||||
# MODE is either `yes' or `no'. If omitted, it defaults to `both'. |
|
||||||
m4_define([_LT_WITH_PIC], |
|
||||||
[AC_ARG_WITH([pic], |
|
||||||
[AS_HELP_STRING([--with-pic@<:@=PKGS@:>@], |
|
||||||
[try to use only PIC/non-PIC objects @<:@default=use both@:>@])], |
|
||||||
[lt_p=${PACKAGE-default} |
|
||||||
case $withval in |
|
||||||
yes|no) pic_mode=$withval ;; |
|
||||||
*) |
|
||||||
pic_mode=default |
|
||||||
# Look at the argument we got. We use all the common list separators. |
|
||||||
lt_save_ifs="$IFS"; IFS="${IFS}$PATH_SEPARATOR," |
|
||||||
for lt_pkg in $withval; do |
|
||||||
IFS="$lt_save_ifs" |
|
||||||
if test "X$lt_pkg" = "X$lt_p"; then |
|
||||||
pic_mode=yes |
|
||||||
fi |
|
||||||
done |
|
||||||
IFS="$lt_save_ifs" |
|
||||||
;; |
|
||||||
esac], |
|
||||||
[pic_mode=default]) |
|
||||||
|
|
||||||
test -z "$pic_mode" && pic_mode=m4_default([$1], [default]) |
|
||||||
|
|
||||||
_LT_DECL([], [pic_mode], [0], [What type of objects to build])dnl |
|
||||||
])# _LT_WITH_PIC |
|
||||||
|
|
||||||
LT_OPTION_DEFINE([LT_INIT], [pic-only], [_LT_WITH_PIC([yes])]) |
|
||||||
LT_OPTION_DEFINE([LT_INIT], [no-pic], [_LT_WITH_PIC([no])]) |
|
||||||
|
|
||||||
# Old name: |
|
||||||
AU_DEFUN([AC_LIBTOOL_PICMODE], |
|
||||||
[_LT_SET_OPTION([LT_INIT], [pic-only]) |
|
||||||
AC_DIAGNOSE([obsolete], |
|
||||||
[$0: Remove this warning and the call to _LT_SET_OPTION when you |
|
||||||
put the `pic-only' option into LT_INIT's first parameter.]) |
|
||||||
]) |
|
||||||
|
|
||||||
dnl aclocal-1.4 backwards compatibility: |
|
||||||
dnl AC_DEFUN([AC_LIBTOOL_PICMODE], []) |
|
||||||
|
|
||||||
## ----------------- ## |
|
||||||
## LTDL_INIT Options ## |
|
||||||
## ----------------- ## |
|
||||||
|
|
||||||
m4_define([_LTDL_MODE], []) |
|
||||||
LT_OPTION_DEFINE([LTDL_INIT], [nonrecursive], |
|
||||||
[m4_define([_LTDL_MODE], [nonrecursive])]) |
|
||||||
LT_OPTION_DEFINE([LTDL_INIT], [recursive], |
|
||||||
[m4_define([_LTDL_MODE], [recursive])]) |
|
||||||
LT_OPTION_DEFINE([LTDL_INIT], [subproject], |
|
||||||
[m4_define([_LTDL_MODE], [subproject])]) |
|
||||||
|
|
||||||
m4_define([_LTDL_TYPE], []) |
|
||||||
LT_OPTION_DEFINE([LTDL_INIT], [installable], |
|
||||||
[m4_define([_LTDL_TYPE], [installable])]) |
|
||||||
LT_OPTION_DEFINE([LTDL_INIT], [convenience], |
|
||||||
[m4_define([_LTDL_TYPE], [convenience])]) |
|
@ -1,123 +0,0 @@ |
|||||||
# ltsugar.m4 -- libtool m4 base layer. -*-Autoconf-*- |
|
||||||
# |
|
||||||
# Copyright (C) 2004, 2005, 2007, 2008 Free Software Foundation, Inc. |
|
||||||
# Written by Gary V. Vaughan, 2004 |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation gives |
|
||||||
# unlimited permission to copy and/or distribute it, with or without |
|
||||||
# modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 6 ltsugar.m4 |
|
||||||
|
|
||||||
# This is to help aclocal find these macros, as it can't see m4_define. |
|
||||||
AC_DEFUN([LTSUGAR_VERSION], [m4_if([0.1])]) |
|
||||||
|
|
||||||
|
|
||||||
# lt_join(SEP, ARG1, [ARG2...]) |
|
||||||
# ----------------------------- |
|
||||||
# Produce ARG1SEPARG2...SEPARGn, omitting [] arguments and their |
|
||||||
# associated separator. |
|
||||||
# Needed until we can rely on m4_join from Autoconf 2.62, since all earlier |
|
||||||
# versions in m4sugar had bugs. |
|
||||||
m4_define([lt_join], |
|
||||||
[m4_if([$#], [1], [], |
|
||||||
[$#], [2], [[$2]], |
|
||||||
[m4_if([$2], [], [], [[$2]_])$0([$1], m4_shift(m4_shift($@)))])]) |
|
||||||
m4_define([_lt_join], |
|
||||||
[m4_if([$#$2], [2], [], |
|
||||||
[m4_if([$2], [], [], [[$1$2]])$0([$1], m4_shift(m4_shift($@)))])]) |
|
||||||
|
|
||||||
|
|
||||||
# lt_car(LIST) |
|
||||||
# lt_cdr(LIST) |
|
||||||
# ------------ |
|
||||||
# Manipulate m4 lists. |
|
||||||
# These macros are necessary as long as will still need to support |
|
||||||
# Autoconf-2.59 which quotes differently. |
|
||||||
m4_define([lt_car], [[$1]]) |
|
||||||
m4_define([lt_cdr], |
|
||||||
[m4_if([$#], 0, [m4_fatal([$0: cannot be called without arguments])], |
|
||||||
[$#], 1, [], |
|
||||||
[m4_dquote(m4_shift($@))])]) |
|
||||||
m4_define([lt_unquote], $1) |
|
||||||
|
|
||||||
|
|
||||||
# lt_append(MACRO-NAME, STRING, [SEPARATOR]) |
|
||||||
# ------------------------------------------ |
|
||||||
# Redefine MACRO-NAME to hold its former content plus `SEPARATOR'`STRING'. |
|
||||||
# Note that neither SEPARATOR nor STRING are expanded; they are appended |
|
||||||
# to MACRO-NAME as is (leaving the expansion for when MACRO-NAME is invoked). |
|
||||||
# No SEPARATOR is output if MACRO-NAME was previously undefined (different |
|
||||||
# than defined and empty). |
|
||||||
# |
|
||||||
# This macro is needed until we can rely on Autoconf 2.62, since earlier |
|
||||||
# versions of m4sugar mistakenly expanded SEPARATOR but not STRING. |
|
||||||
m4_define([lt_append], |
|
||||||
[m4_define([$1], |
|
||||||
m4_ifdef([$1], [m4_defn([$1])[$3]])[$2])]) |
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
# lt_combine(SEP, PREFIX-LIST, INFIX, SUFFIX1, [SUFFIX2...]) |
|
||||||
# ---------------------------------------------------------- |
|
||||||
# Produce a SEP delimited list of all paired combinations of elements of |
|
||||||
# PREFIX-LIST with SUFFIX1 through SUFFIXn. Each element of the list |
|
||||||
# has the form PREFIXmINFIXSUFFIXn. |
|
||||||
# Needed until we can rely on m4_combine added in Autoconf 2.62. |
|
||||||
m4_define([lt_combine], |
|
||||||
[m4_if(m4_eval([$# > 3]), [1], |
|
||||||
[m4_pushdef([_Lt_sep], [m4_define([_Lt_sep], m4_defn([lt_car]))])]]dnl |
|
||||||
[[m4_foreach([_Lt_prefix], [$2], |
|
||||||
[m4_foreach([_Lt_suffix], |
|
||||||
]m4_dquote(m4_dquote(m4_shift(m4_shift(m4_shift($@)))))[, |
|
||||||
[_Lt_sep([$1])[]m4_defn([_Lt_prefix])[$3]m4_defn([_Lt_suffix])])])])]) |
|
||||||
|
|
||||||
|
|
||||||
# lt_if_append_uniq(MACRO-NAME, VARNAME, [SEPARATOR], [UNIQ], [NOT-UNIQ]) |
|
||||||
# ----------------------------------------------------------------------- |
|
||||||
# Iff MACRO-NAME does not yet contain VARNAME, then append it (delimited |
|
||||||
# by SEPARATOR if supplied) and expand UNIQ, else NOT-UNIQ. |
|
||||||
m4_define([lt_if_append_uniq], |
|
||||||
[m4_ifdef([$1], |
|
||||||
[m4_if(m4_index([$3]m4_defn([$1])[$3], [$3$2$3]), [-1], |
|
||||||
[lt_append([$1], [$2], [$3])$4], |
|
||||||
[$5])], |
|
||||||
[lt_append([$1], [$2], [$3])$4])]) |
|
||||||
|
|
||||||
|
|
||||||
# lt_dict_add(DICT, KEY, VALUE) |
|
||||||
# ----------------------------- |
|
||||||
m4_define([lt_dict_add], |
|
||||||
[m4_define([$1($2)], [$3])]) |
|
||||||
|
|
||||||
|
|
||||||
# lt_dict_add_subkey(DICT, KEY, SUBKEY, VALUE) |
|
||||||
# -------------------------------------------- |
|
||||||
m4_define([lt_dict_add_subkey], |
|
||||||
[m4_define([$1($2:$3)], [$4])]) |
|
||||||
|
|
||||||
|
|
||||||
# lt_dict_fetch(DICT, KEY, [SUBKEY]) |
|
||||||
# ---------------------------------- |
|
||||||
m4_define([lt_dict_fetch], |
|
||||||
[m4_ifval([$3], |
|
||||||
m4_ifdef([$1($2:$3)], [m4_defn([$1($2:$3)])]), |
|
||||||
m4_ifdef([$1($2)], [m4_defn([$1($2)])]))]) |
|
||||||
|
|
||||||
|
|
||||||
# lt_if_dict_fetch(DICT, KEY, [SUBKEY], VALUE, IF-TRUE, [IF-FALSE]) |
|
||||||
# ----------------------------------------------------------------- |
|
||||||
m4_define([lt_if_dict_fetch], |
|
||||||
[m4_if(lt_dict_fetch([$1], [$2], [$3]), [$4], |
|
||||||
[$5], |
|
||||||
[$6])]) |
|
||||||
|
|
||||||
|
|
||||||
# lt_dict_filter(DICT, [SUBKEY], VALUE, [SEPARATOR], KEY, [...]) |
|
||||||
# -------------------------------------------------------------- |
|
||||||
m4_define([lt_dict_filter], |
|
||||||
[m4_if([$5], [], [], |
|
||||||
[lt_join(m4_quote(m4_default([$4], [[, ]])), |
|
||||||
lt_unquote(m4_split(m4_normalize(m4_foreach(_Lt_key, lt_car([m4_shiftn(4, $@)]), |
|
||||||
[lt_if_dict_fetch([$1], _Lt_key, [$2], [$3], [_Lt_key ])])))))])[]dnl |
|
||||||
]) |
|
@ -1,23 +0,0 @@ |
|||||||
# ltversion.m4 -- version numbers -*- Autoconf -*- |
|
||||||
# |
|
||||||
# Copyright (C) 2004 Free Software Foundation, Inc. |
|
||||||
# Written by Scott James Remnant, 2004 |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation gives |
|
||||||
# unlimited permission to copy and/or distribute it, with or without |
|
||||||
# modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# @configure_input@ |
|
||||||
|
|
||||||
# serial 3337 ltversion.m4 |
|
||||||
# This file is part of GNU Libtool |
|
||||||
|
|
||||||
m4_define([LT_PACKAGE_VERSION], [2.4.2]) |
|
||||||
m4_define([LT_PACKAGE_REVISION], [1.3337]) |
|
||||||
|
|
||||||
AC_DEFUN([LTVERSION_VERSION], |
|
||||||
[macro_version='2.4.2' |
|
||||||
macro_revision='1.3337' |
|
||||||
_LT_DECL(, macro_version, 0, [Which release of libtool.m4 was used?]) |
|
||||||
_LT_DECL(, macro_revision, 0) |
|
||||||
]) |
|
@ -1,98 +0,0 @@ |
|||||||
# lt~obsolete.m4 -- aclocal satisfying obsolete definitions. -*-Autoconf-*- |
|
||||||
# |
|
||||||
# Copyright (C) 2004, 2005, 2007, 2009 Free Software Foundation, Inc. |
|
||||||
# Written by Scott James Remnant, 2004. |
|
||||||
# |
|
||||||
# This file is free software; the Free Software Foundation gives |
|
||||||
# unlimited permission to copy and/or distribute it, with or without |
|
||||||
# modifications, as long as this notice is preserved. |
|
||||||
|
|
||||||
# serial 5 lt~obsolete.m4 |
|
||||||
|
|
||||||
# These exist entirely to fool aclocal when bootstrapping libtool. |
|
||||||
# |
|
||||||
# In the past libtool.m4 has provided macros via AC_DEFUN (or AU_DEFUN) |
|
||||||
# which have later been changed to m4_define as they aren't part of the |
|
||||||
# exported API, or moved to Autoconf or Automake where they belong. |
|
||||||
# |
|
||||||
# The trouble is, aclocal is a bit thick. It'll see the old AC_DEFUN |
|
||||||
# in /usr/share/aclocal/libtool.m4 and remember it, then when it sees us |
|
||||||
# using a macro with the same name in our local m4/libtool.m4 it'll |
|
||||||
# pull the old libtool.m4 in (it doesn't see our shiny new m4_define |
|
||||||
# and doesn't know about Autoconf macros at all.) |
|
||||||
# |
|
||||||
# So we provide this file, which has a silly filename so it's always |
|
||||||
# included after everything else. This provides aclocal with the |
|
||||||
# AC_DEFUNs it wants, but when m4 processes it, it doesn't do anything |
|
||||||
# because those macros already exist, or will be overwritten later. |
|
||||||
# We use AC_DEFUN over AU_DEFUN for compatibility with aclocal-1.6. |
|
||||||
# |
|
||||||
# Anytime we withdraw an AC_DEFUN or AU_DEFUN, remember to add it here. |
|
||||||
# Yes, that means every name once taken will need to remain here until |
|
||||||
# we give up compatibility with versions before 1.7, at which point |
|
||||||
# we need to keep only those names which we still refer to. |
|
||||||
|
|
||||||
# This is to help aclocal find these macros, as it can't see m4_define. |
|
||||||
AC_DEFUN([LTOBSOLETE_VERSION], [m4_if([1])]) |
|
||||||
|
|
||||||
m4_ifndef([AC_LIBTOOL_LINKER_OPTION], [AC_DEFUN([AC_LIBTOOL_LINKER_OPTION])]) |
|
||||||
m4_ifndef([AC_PROG_EGREP], [AC_DEFUN([AC_PROG_EGREP])]) |
|
||||||
m4_ifndef([_LT_AC_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_AC_PROG_ECHO_BACKSLASH])]) |
|
||||||
m4_ifndef([_LT_AC_SHELL_INIT], [AC_DEFUN([_LT_AC_SHELL_INIT])]) |
|
||||||
m4_ifndef([_LT_AC_SYS_LIBPATH_AIX], [AC_DEFUN([_LT_AC_SYS_LIBPATH_AIX])]) |
|
||||||
m4_ifndef([_LT_PROG_LTMAIN], [AC_DEFUN([_LT_PROG_LTMAIN])]) |
|
||||||
m4_ifndef([_LT_AC_TAGVAR], [AC_DEFUN([_LT_AC_TAGVAR])]) |
|
||||||
m4_ifndef([AC_LTDL_ENABLE_INSTALL], [AC_DEFUN([AC_LTDL_ENABLE_INSTALL])]) |
|
||||||
m4_ifndef([AC_LTDL_PREOPEN], [AC_DEFUN([AC_LTDL_PREOPEN])]) |
|
||||||
m4_ifndef([_LT_AC_SYS_COMPILER], [AC_DEFUN([_LT_AC_SYS_COMPILER])]) |
|
||||||
m4_ifndef([_LT_AC_LOCK], [AC_DEFUN([_LT_AC_LOCK])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_SYS_OLD_ARCHIVE], [AC_DEFUN([AC_LIBTOOL_SYS_OLD_ARCHIVE])]) |
|
||||||
m4_ifndef([_LT_AC_TRY_DLOPEN_SELF], [AC_DEFUN([_LT_AC_TRY_DLOPEN_SELF])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_PROG_CC_C_O], [AC_DEFUN([AC_LIBTOOL_PROG_CC_C_O])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_SYS_HARD_LINK_LOCKS], [AC_DEFUN([AC_LIBTOOL_SYS_HARD_LINK_LOCKS])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_OBJDIR], [AC_DEFUN([AC_LIBTOOL_OBJDIR])]) |
|
||||||
m4_ifndef([AC_LTDL_OBJDIR], [AC_DEFUN([AC_LTDL_OBJDIR])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH], [AC_DEFUN([AC_LIBTOOL_PROG_LD_HARDCODE_LIBPATH])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_SYS_LIB_STRIP], [AC_DEFUN([AC_LIBTOOL_SYS_LIB_STRIP])]) |
|
||||||
m4_ifndef([AC_PATH_MAGIC], [AC_DEFUN([AC_PATH_MAGIC])]) |
|
||||||
m4_ifndef([AC_PROG_LD_GNU], [AC_DEFUN([AC_PROG_LD_GNU])]) |
|
||||||
m4_ifndef([AC_PROG_LD_RELOAD_FLAG], [AC_DEFUN([AC_PROG_LD_RELOAD_FLAG])]) |
|
||||||
m4_ifndef([AC_DEPLIBS_CHECK_METHOD], [AC_DEFUN([AC_DEPLIBS_CHECK_METHOD])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_NO_RTTI], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_NO_RTTI])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE], [AC_DEFUN([AC_LIBTOOL_SYS_GLOBAL_SYMBOL_PIPE])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_PROG_COMPILER_PIC], [AC_DEFUN([AC_LIBTOOL_PROG_COMPILER_PIC])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_PROG_LD_SHLIBS], [AC_DEFUN([AC_LIBTOOL_PROG_LD_SHLIBS])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_POSTDEP_PREDEP], [AC_DEFUN([AC_LIBTOOL_POSTDEP_PREDEP])]) |
|
||||||
m4_ifndef([LT_AC_PROG_EGREP], [AC_DEFUN([LT_AC_PROG_EGREP])]) |
|
||||||
m4_ifndef([LT_AC_PROG_SED], [AC_DEFUN([LT_AC_PROG_SED])]) |
|
||||||
m4_ifndef([_LT_CC_BASENAME], [AC_DEFUN([_LT_CC_BASENAME])]) |
|
||||||
m4_ifndef([_LT_COMPILER_BOILERPLATE], [AC_DEFUN([_LT_COMPILER_BOILERPLATE])]) |
|
||||||
m4_ifndef([_LT_LINKER_BOILERPLATE], [AC_DEFUN([_LT_LINKER_BOILERPLATE])]) |
|
||||||
m4_ifndef([_AC_PROG_LIBTOOL], [AC_DEFUN([_AC_PROG_LIBTOOL])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_SETUP], [AC_DEFUN([AC_LIBTOOL_SETUP])]) |
|
||||||
m4_ifndef([_LT_AC_CHECK_DLFCN], [AC_DEFUN([_LT_AC_CHECK_DLFCN])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_SYS_DYNAMIC_LINKER], [AC_DEFUN([AC_LIBTOOL_SYS_DYNAMIC_LINKER])]) |
|
||||||
m4_ifndef([_LT_AC_TAGCONFIG], [AC_DEFUN([_LT_AC_TAGCONFIG])]) |
|
||||||
m4_ifndef([AC_DISABLE_FAST_INSTALL], [AC_DEFUN([AC_DISABLE_FAST_INSTALL])]) |
|
||||||
m4_ifndef([_LT_AC_LANG_CXX], [AC_DEFUN([_LT_AC_LANG_CXX])]) |
|
||||||
m4_ifndef([_LT_AC_LANG_F77], [AC_DEFUN([_LT_AC_LANG_F77])]) |
|
||||||
m4_ifndef([_LT_AC_LANG_GCJ], [AC_DEFUN([_LT_AC_LANG_GCJ])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_LANG_C_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_C_CONFIG])]) |
|
||||||
m4_ifndef([_LT_AC_LANG_C_CONFIG], [AC_DEFUN([_LT_AC_LANG_C_CONFIG])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_LANG_CXX_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_CXX_CONFIG])]) |
|
||||||
m4_ifndef([_LT_AC_LANG_CXX_CONFIG], [AC_DEFUN([_LT_AC_LANG_CXX_CONFIG])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_LANG_F77_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_F77_CONFIG])]) |
|
||||||
m4_ifndef([_LT_AC_LANG_F77_CONFIG], [AC_DEFUN([_LT_AC_LANG_F77_CONFIG])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_LANG_GCJ_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_GCJ_CONFIG])]) |
|
||||||
m4_ifndef([_LT_AC_LANG_GCJ_CONFIG], [AC_DEFUN([_LT_AC_LANG_GCJ_CONFIG])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_LANG_RC_CONFIG], [AC_DEFUN([AC_LIBTOOL_LANG_RC_CONFIG])]) |
|
||||||
m4_ifndef([_LT_AC_LANG_RC_CONFIG], [AC_DEFUN([_LT_AC_LANG_RC_CONFIG])]) |
|
||||||
m4_ifndef([AC_LIBTOOL_CONFIG], [AC_DEFUN([AC_LIBTOOL_CONFIG])]) |
|
||||||
m4_ifndef([_LT_AC_FILE_LTDLL_C], [AC_DEFUN([_LT_AC_FILE_LTDLL_C])]) |
|
||||||
m4_ifndef([_LT_REQUIRED_DARWIN_CHECKS], [AC_DEFUN([_LT_REQUIRED_DARWIN_CHECKS])]) |
|
||||||
m4_ifndef([_LT_AC_PROG_CXXCPP], [AC_DEFUN([_LT_AC_PROG_CXXCPP])]) |
|
||||||
m4_ifndef([_LT_PREPARE_SED_QUOTE_VARS], [AC_DEFUN([_LT_PREPARE_SED_QUOTE_VARS])]) |
|
||||||
m4_ifndef([_LT_PROG_ECHO_BACKSLASH], [AC_DEFUN([_LT_PROG_ECHO_BACKSLASH])]) |
|
||||||
m4_ifndef([_LT_PROG_F77], [AC_DEFUN([_LT_PROG_F77])]) |
|
||||||
m4_ifndef([_LT_PROG_FC], [AC_DEFUN([_LT_PROG_FC])]) |
|
||||||
m4_ifndef([_LT_PROG_CXX], [AC_DEFUN([_LT_PROG_CXX])]) |
|
@ -1,115 +0,0 @@ |
|||||||
dnl --------------------------------------------------------------------------- |
|
||||||
dnl Copyright (C) 2009-2011 FuseSource Corp. |
|
||||||
dnl http://fusesource.com |
|
||||||
dnl |
|
||||||
dnl Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
dnl you may not use this file except in compliance with the License. |
|
||||||
dnl You may obtain a copy of the License at |
|
||||||
dnl |
|
||||||
dnl http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
dnl |
|
||||||
dnl Unless required by applicable law or agreed to in writing, software |
|
||||||
dnl distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
dnl WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
dnl See the License for the specific language governing permissions and |
|
||||||
dnl limitations under the License. |
|
||||||
dnl --------------------------------------------------------------------------- |
|
||||||
dnl --------------------------------------------------------------------------- |
|
||||||
dnl SYNOPSIS: |
|
||||||
dnl |
|
||||||
dnl WITH_OSX_UNIVERSAL() |
|
||||||
dnl |
|
||||||
dnl Allows creating universal binaries on the |
|
||||||
dnl |
|
||||||
dnl Adds the --with-universal=ARCH option. This will will |
|
||||||
dnl set -isysroot option to the location of the MacOSX${OSX_VERSION}.sdk. |
|
||||||
dnl if OSX_VERSION is not defined, it will set it to the latest version |
|
||||||
dnl of the SDK installed on your system. |
|
||||||
dnl |
|
||||||
dnl You must use the no-dependencies option when automake is initialized. |
|
||||||
dnl for example: AM_INIT_AUTOMAKE([no-dependencies]) |
|
||||||
dnl |
|
||||||
dnl This macro calls: |
|
||||||
dnl AC_SUBST(CFLAGS) |
|
||||||
dnl AC_SUBST(CXXFLAGS) |
|
||||||
dnl AC_SUBST(LDFLAGS) |
|
||||||
dnl AC_SUBST(OSX_VERSION) |
|
||||||
dnl |
|
||||||
dnl AUTHOR: <a href="http://hiramchirino.com">Hiram Chrino</a> |
|
||||||
dnl --------------------------------------------------------------------------- |
|
||||||
|
|
||||||
AC_DEFUN([WITH_OSX_UNIVERSAL], |
|
||||||
[ |
|
||||||
AC_PREREQ([2.61]) |
|
||||||
case "$host_os" in |
|
||||||
darwin*) |
|
||||||
|
|
||||||
AC_MSG_CHECKING(OS X SDK version) |
|
||||||
AC_ARG_WITH([osxsdk], |
|
||||||
[AS_HELP_STRING([--with-osxsdk@<:@=VERSION@:>@], |
|
||||||
[OS X SDK version to build against. Example: --with-osxsdk=10.6])], |
|
||||||
[ |
|
||||||
OSX_UNIVERSAL="$withval" |
|
||||||
],[ |
|
||||||
OSX_SDKS_DIR="" |
|
||||||
OSX_VERSION="" |
|
||||||
for v in 10.0 10.1 10.2 10.3 10.4 10.5 10.6 10.7 10.8 10.9 10.10 10.11 10.12; do |
|
||||||
for location in "/Developer/SDKs" "/Applications/Xcode.app/Contents/Developer/Platforms/MacOSX.platform/Developer/SDKs" ; do |
|
||||||
if test -z "${OSX_VERSION}" && test -d "${location}/MacOSX${v}.sdk" ; then |
|
||||||
OSX_SDKS_DIR="${location}" |
|
||||||
OSX_VERSION="${v}" |
|
||||||
fi |
|
||||||
done |
|
||||||
done |
|
||||||
]) |
|
||||||
AC_MSG_RESULT([$OSX_VERSION]) |
|
||||||
AC_SUBST(OSX_SDKS_DIR) |
|
||||||
AC_SUBST(OSX_VERSION) |
|
||||||
|
|
||||||
AC_MSG_CHECKING(whether to build universal binaries) |
|
||||||
AC_ARG_WITH([universal], |
|
||||||
[AS_HELP_STRING([--with-universal@<:@=ARCH@:>@], |
|
||||||
[Build a universal binary. Set to a space separated architecture list. Pick from: i386, x86_64, ppc, and/or ppc64. @<:@default="i386 x86_64"@:>@])], |
|
||||||
[ |
|
||||||
AS_IF(test "$withval" = "no", [ |
|
||||||
OSX_UNIVERSAL="" |
|
||||||
AC_MSG_RESULT([no]) |
|
||||||
], test "$withval" = "yes", [ |
|
||||||
OSX_UNIVERSAL="i386 x86_64" |
|
||||||
AC_MSG_RESULT([yes, archs: $OSX_UNIVERSAL]) |
|
||||||
],[ |
|
||||||
OSX_UNIVERSAL="$withval" |
|
||||||
AC_MSG_RESULT([yes, archs: $OSX_UNIVERSAL]) |
|
||||||
]) |
|
||||||
],[ |
|
||||||
OSX_UNIVERSAL="" |
|
||||||
AC_MSG_RESULT([no]) |
|
||||||
]) |
|
||||||
|
|
||||||
AS_IF(test -n "$OSX_UNIVERSAL", [ |
|
||||||
for i in $OSX_UNIVERSAL ; do |
|
||||||
CFLAGS="-arch $i $CFLAGS" |
|
||||||
CXXFLAGS="-arch $i $CXXFLAGS" |
|
||||||
LDFLAGS="-arch $i $LDFLAGS" |
|
||||||
done |
|
||||||
|
|
||||||
|
|
||||||
for f in $__JNI_INCLUDE_EXTRAS ; do |
|
||||||
if test -d "$__JNI_INCLUDE/$f"; then |
|
||||||
__JNI_CFLAGS="$__JNI_CFLAGS -I$__JNI_INCLUDE/$f" |
|
||||||
fi |
|
||||||
done |
|
||||||
|
|
||||||
|
|
||||||
CFLAGS="-isysroot ${OSX_SDKS_DIR}/MacOSX${OSX_VERSION}.sdk $CFLAGS" |
|
||||||
CXXFLAGS="-isysroot ${OSX_SDKS_DIR}/MacOSX${OSX_VERSION}.sdk $CXXFLAGS" |
|
||||||
LDFLAGS="-syslibroot,${OSX_SDKS_DIR}/MacOSX${OSX_VERSION}.sdk $LDFLAGS" |
|
||||||
AC_SUBST(CFLAGS) |
|
||||||
AC_SUBST(CXXFLAGS) |
|
||||||
AC_SUBST(LDFLAGS) |
|
||||||
]) |
|
||||||
;; |
|
||||||
esac |
|
||||||
]) |
|
||||||
|
|
||||||
|
|
@ -1,36 +0,0 @@ |
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
*
|
|
||||||
* 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. |
|
||||||
*******************************************************************************/ |
|
||||||
#include "leveldbjni.h" |
|
||||||
|
|
||||||
void buffer_copy(const void *source, size_t source_pos, void *dest, size_t dest_pos, size_t length) { |
|
||||||
memmove(((char *)dest)+dest_pos, ((const char *)source)+source_pos, length); |
|
||||||
} |
|
@ -1,68 +0,0 @@ |
|||||||
/* src/config.h.in. Generated from configure.ac by autoheader. */ |
|
||||||
|
|
||||||
/* Define to 1 if you have the <dlfcn.h> header file. */ |
|
||||||
#undef HAVE_DLFCN_H |
|
||||||
|
|
||||||
/* Define to 1 if you have the <inttypes.h> header file. */ |
|
||||||
#undef HAVE_INTTYPES_H |
|
||||||
|
|
||||||
/* Define to 1 if you have the <memory.h> header file. */ |
|
||||||
#undef HAVE_MEMORY_H |
|
||||||
|
|
||||||
/* Define to 1 if you have the <pthread.h> header file. */ |
|
||||||
#undef HAVE_PTHREAD_H |
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdint.h> header file. */ |
|
||||||
#undef HAVE_STDINT_H |
|
||||||
|
|
||||||
/* Define to 1 if you have the <stdlib.h> header file. */ |
|
||||||
#undef HAVE_STDLIB_H |
|
||||||
|
|
||||||
/* Define to 1 if you have the <strings.h> header file. */ |
|
||||||
#undef HAVE_STRINGS_H |
|
||||||
|
|
||||||
/* Define to 1 if you have the <string.h> header file. */ |
|
||||||
#undef HAVE_STRING_H |
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/errno.h> header file. */ |
|
||||||
#undef HAVE_SYS_ERRNO_H |
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/stat.h> header file. */ |
|
||||||
#undef HAVE_SYS_STAT_H |
|
||||||
|
|
||||||
/* Define to 1 if you have the <sys/types.h> header file. */ |
|
||||||
#undef HAVE_SYS_TYPES_H |
|
||||||
|
|
||||||
/* Define to 1 if you have the <unistd.h> header file. */ |
|
||||||
#undef HAVE_UNISTD_H |
|
||||||
|
|
||||||
/* Define to the sub-directory in which libtool stores uninstalled libraries.
|
|
||||||
*/ |
|
||||||
#undef LT_OBJDIR |
|
||||||
|
|
||||||
/* Name of package */ |
|
||||||
#undef PACKAGE |
|
||||||
|
|
||||||
/* Define to the address where bug reports for this package should be sent. */ |
|
||||||
#undef PACKAGE_BUGREPORT |
|
||||||
|
|
||||||
/* Define to the full name of this package. */ |
|
||||||
#undef PACKAGE_NAME |
|
||||||
|
|
||||||
/* Define to the full name and version of this package. */ |
|
||||||
#undef PACKAGE_STRING |
|
||||||
|
|
||||||
/* Define to the one symbol short name of this package. */ |
|
||||||
#undef PACKAGE_TARNAME |
|
||||||
|
|
||||||
/* Define to the home page for this package. */ |
|
||||||
#undef PACKAGE_URL |
|
||||||
|
|
||||||
/* Define to the version of this package. */ |
|
||||||
#undef PACKAGE_VERSION |
|
||||||
|
|
||||||
/* Define to 1 if you have the ANSI C header files. */ |
|
||||||
#undef STDC_HEADERS |
|
||||||
|
|
||||||
/* Version number of package */ |
|
||||||
#undef VERSION |
|
@ -1,142 +0,0 @@ |
|||||||
/*******************************************************************************
|
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
*
|
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
*
|
|
||||||
* 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. |
|
||||||
*******************************************************************************/ |
|
||||||
#ifndef LEVELDBJNI_H |
|
||||||
#define LEVELDBJNI_H |
|
||||||
|
|
||||||
#ifdef HAVE_CONFIG_H |
|
||||||
/* configure based build.. we will use what it discovered about the platform */ |
|
||||||
#include "config.h" |
|
||||||
#else |
|
||||||
#if defined(_WIN32) || defined(_WIN64) |
|
||||||
/* Windows based build */ |
|
||||||
#define HAVE_STDLIB_H 1 |
|
||||||
#define HAVE_STRINGS_H 1 |
|
||||||
#include <windows.h> |
|
||||||
#endif |
|
||||||
#endif |
|
||||||
|
|
||||||
#ifdef HAVE_UNISTD_H |
|
||||||
#include <unistd.h> |
|
||||||
#endif |
|
||||||
|
|
||||||
#ifdef HAVE_STDLIB_H |
|
||||||
#include <stdlib.h> |
|
||||||
#endif |
|
||||||
|
|
||||||
#ifdef HAVE_STRINGS_H |
|
||||||
#include <string.h> |
|
||||||
#endif |
|
||||||
|
|
||||||
#ifdef HAVE_SYS_ERRNO_H |
|
||||||
#include <sys/errno.h> |
|
||||||
#endif |
|
||||||
|
|
||||||
#include "hawtjni.h" |
|
||||||
#include <stdint.h> |
|
||||||
#include <stdarg.h> |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
|
|
||||||
#include "leveldb/db.h" |
|
||||||
#include "leveldb/options.h" |
|
||||||
#include "leveldb/write_batch.h" |
|
||||||
#include "leveldb/cache.h" |
|
||||||
#include "leveldb/comparator.h" |
|
||||||
#include "leveldb/env.h" |
|
||||||
#include "leveldb/slice.h" |
|
||||||
|
|
||||||
struct JNIComparator : public rocksdb::Comparator { |
|
||||||
jobject target; |
|
||||||
jmethodID compare_method; |
|
||||||
const char *name; |
|
||||||
|
|
||||||
int Compare(const rocksdb::Slice& a, const rocksdb::Slice& b) const { |
|
||||||
JNIEnv *env; |
|
||||||
if ( hawtjni_attach_thread(&env, "leveldb") ) { |
|
||||||
return 0; |
|
||||||
} |
|
||||||
int rc = env->CallIntMethod(target, compare_method, (jlong)(intptr_t)&a, (jlong)(intptr_t)&b); |
|
||||||
hawtjni_detach_thread(); |
|
||||||
return rc; |
|
||||||
} |
|
||||||
|
|
||||||
const char* Name() const { |
|
||||||
return name; |
|
||||||
} |
|
||||||
|
|
||||||
void FindShortestSeparator(std::string*, const rocksdb::Slice&) const { } |
|
||||||
void FindShortSuccessor(std::string*) const { } |
|
||||||
}; |
|
||||||
|
|
||||||
struct JNILogger : public rocksdb::Logger { |
|
||||||
jobject target; |
|
||||||
jmethodID log_method; |
|
||||||
|
|
||||||
void Logv(const char* format, va_list ap) { |
|
||||||
JNIEnv *env; |
|
||||||
if ( hawtjni_attach_thread(&env, "leveldb") ) { |
|
||||||
return; |
|
||||||
} |
|
||||||
|
|
||||||
char buffer[1024]; |
|
||||||
vsnprintf(buffer, sizeof(buffer), format, ap); |
|
||||||
|
|
||||||
jstring message = env->NewStringUTF(buffer); |
|
||||||
if( message ) { |
|
||||||
env->CallVoidMethod(target, log_method, message); |
|
||||||
env->DeleteLocalRef(message); |
|
||||||
} |
|
||||||
|
|
||||||
if (env->ExceptionOccurred() ) { |
|
||||||
env->ExceptionDescribe(); |
|
||||||
env->ExceptionClear(); |
|
||||||
} |
|
||||||
hawtjni_detach_thread(); |
|
||||||
} |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
#endif |
|
||||||
|
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
extern "C" { |
|
||||||
#endif |
|
||||||
|
|
||||||
void buffer_copy(const void *source, size_t source_pos, void *dest, size_t dest_pos, size_t length); |
|
||||||
|
|
||||||
#ifdef __cplusplus |
|
||||||
} /* extern "C" */ |
|
||||||
#endif |
|
||||||
|
|
||||||
|
|
||||||
#endif /* LEVELDBJNI_H */ |
|
@ -1,194 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="utf-8"?> |
|
||||||
<!-- msbuild vs2008.vcxproj --> |
|
||||||
<Project DefaultTargets="Build" ToolsVersion="4.0" xmlns="http://schemas.microsoft.com/developer/msbuild/2003"> |
|
||||||
<ItemGroup Label="ProjectConfigurations"> |
|
||||||
<ProjectConfiguration Include="debug|Win32"> |
|
||||||
<Configuration>debug</Configuration> |
|
||||||
<Platform>Win32</Platform> |
|
||||||
</ProjectConfiguration> |
|
||||||
<ProjectConfiguration Include="debug|x64"> |
|
||||||
<Configuration>debug</Configuration> |
|
||||||
<Platform>x64</Platform> |
|
||||||
</ProjectConfiguration> |
|
||||||
<ProjectConfiguration Include="release|Win32"> |
|
||||||
<Configuration>release</Configuration> |
|
||||||
<Platform>Win32</Platform> |
|
||||||
</ProjectConfiguration> |
|
||||||
<ProjectConfiguration Include="release|x64"> |
|
||||||
<Configuration>release</Configuration> |
|
||||||
<Platform>x64</Platform> |
|
||||||
</ProjectConfiguration> |
|
||||||
</ItemGroup> |
|
||||||
<PropertyGroup Label="Globals"> |
|
||||||
<ProjectName>leveldbjni</ProjectName> |
|
||||||
<RootNamespace>leveldbjni</RootNamespace> |
|
||||||
</PropertyGroup> |
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.Default.props" /> |
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="Configuration"> |
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType> |
|
||||||
<CharacterSet>Unicode</CharacterSet> |
|
||||||
</PropertyGroup> |
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="Configuration"> |
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType> |
|
||||||
<CharacterSet>Unicode</CharacterSet> |
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
|
||||||
</PropertyGroup> |
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="Configuration"> |
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType> |
|
||||||
<CharacterSet>Unicode</CharacterSet> |
|
||||||
</PropertyGroup> |
|
||||||
<PropertyGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="Configuration"> |
|
||||||
<ConfigurationType>DynamicLibrary</ConfigurationType> |
|
||||||
<CharacterSet>Unicode</CharacterSet> |
|
||||||
<WholeProgramOptimization>true</WholeProgramOptimization> |
|
||||||
</PropertyGroup> |
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.props" /> |
|
||||||
<ImportGroup Label="ExtensionSettings"> |
|
||||||
</ImportGroup> |
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|Win32'" Label="PropertySheets"> |
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
|
||||||
</ImportGroup> |
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'" Label="PropertySheets"> |
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
|
||||||
</ImportGroup> |
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'" Label="PropertySheets"> |
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
|
||||||
</ImportGroup> |
|
||||||
<ImportGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'" Label="PropertySheets"> |
|
||||||
<Import Project="$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props" Condition="exists('$(UserRootDir)\Microsoft.Cpp.$(Platform).user.props')" Label="LocalAppDataPlatform" /> |
|
||||||
</ImportGroup> |
|
||||||
<PropertyGroup Label="UserMacros" /> |
|
||||||
<PropertyGroup> |
|
||||||
<_ProjectFileVersion>10.0.30319.1</_ProjectFileVersion> |
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">$(ProjectDir)/target/$(Platform)-$(Configuration)/lib\</OutDir> |
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|Win32'">$(ProjectDir)/target/$(Platform)-$(Configuration)/obj\</IntDir> |
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release|Win32'">false</LinkIncremental> |
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">$(ProjectDir)/target/$(Platform)-$(Configuration)/lib\</OutDir> |
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='release|x64'">$(ProjectDir)/target/$(Platform)-$(Configuration)/obj\</IntDir> |
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='release|x64'">false</LinkIncremental> |
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)/target/$(Platform)-$(Configuration)/lib\</OutDir> |
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">$(ProjectDir)/target/$(Platform)-$(Configuration)/obj\</IntDir> |
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'">true</LinkIncremental> |
|
||||||
<OutDir Condition="'$(Configuration)|$(Platform)'=='debug|x64'">$(ProjectDir)/target/$(Platform)-$(Configuration)/lib\</OutDir> |
|
||||||
<IntDir Condition="'$(Configuration)|$(Platform)'=='debug|x64'">$(ProjectDir)/target/$(Platform)-$(Configuration)/obj\</IntDir> |
|
||||||
<LinkIncremental Condition="'$(Configuration)|$(Platform)'=='debug|x64'">true</LinkIncremental> |
|
||||||
</PropertyGroup> |
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|Win32'"> |
|
||||||
<ClCompile> |
|
||||||
<AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\src\windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
|
||||||
<Optimization>MaxSpeed</Optimization> |
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> |
|
||||||
<PreprocessorDefinitions>WIN32;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
|
||||||
<ExceptionHandling>Sync</ExceptionHandling> |
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> |
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
|
||||||
<RuntimeTypeInfo>false</RuntimeTypeInfo> |
|
||||||
<PrecompiledHeader> |
|
||||||
</PrecompiledHeader> |
|
||||||
<WarningLevel>Level3</WarningLevel> |
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |
|
||||||
</ClCompile> |
|
||||||
<Link> |
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
|
||||||
<SubSystem>Windows</SubSystem> |
|
||||||
<OptimizeReferences>true</OptimizeReferences> |
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
|
||||||
<TargetMachine>MachineX86</TargetMachine> |
|
||||||
</Link> |
|
||||||
</ItemDefinitionGroup> |
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='release|x64'"> |
|
||||||
<ClCompile> |
|
||||||
<AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\src\windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
|
||||||
<Optimization>MaxSpeed</Optimization> |
|
||||||
<IntrinsicFunctions>true</IntrinsicFunctions> |
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> |
|
||||||
<PreprocessorDefinitions>WIN64;NDEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
|
||||||
<ExceptionHandling>Sync</ExceptionHandling> |
|
||||||
<RuntimeLibrary>MultiThreadedDLL</RuntimeLibrary> |
|
||||||
<FunctionLevelLinking>true</FunctionLevelLinking> |
|
||||||
<RuntimeTypeInfo>false</RuntimeTypeInfo> |
|
||||||
<PrecompiledHeader> |
|
||||||
</PrecompiledHeader> |
|
||||||
<WarningLevel>Level3</WarningLevel> |
|
||||||
<DebugInformationFormat>ProgramDatabase</DebugInformationFormat> |
|
||||||
</ClCompile> |
|
||||||
<Link> |
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
|
||||||
<SubSystem>Windows</SubSystem> |
|
||||||
<OptimizeReferences>true</OptimizeReferences> |
|
||||||
<EnableCOMDATFolding>true</EnableCOMDATFolding> |
|
||||||
<TargetMachine>MachineX64</TargetMachine> |
|
||||||
</Link> |
|
||||||
</ItemDefinitionGroup> |
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='Debug|Win32'"> |
|
||||||
<ClCompile> |
|
||||||
<AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\src\windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
|
||||||
<Optimization>Disabled</Optimization> |
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> |
|
||||||
<PreprocessorDefinitions>WIN32;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
|
||||||
<MinimalRebuild>true</MinimalRebuild> |
|
||||||
<ExceptionHandling>Sync</ExceptionHandling> |
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> |
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> |
|
||||||
<RuntimeTypeInfo>false</RuntimeTypeInfo> |
|
||||||
<PrecompiledHeader> |
|
||||||
</PrecompiledHeader> |
|
||||||
<WarningLevel>Level3</WarningLevel> |
|
||||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat> |
|
||||||
</ClCompile> |
|
||||||
<Link> |
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
|
||||||
<SubSystem>Windows</SubSystem> |
|
||||||
<TargetMachine>MachineX86</TargetMachine> |
|
||||||
</Link> |
|
||||||
</ItemDefinitionGroup> |
|
||||||
<ItemDefinitionGroup Condition="'$(Configuration)|$(Platform)'=='debug|x64'"> |
|
||||||
<ClCompile> |
|
||||||
<AdditionalIncludeDirectories>$(JAVA_HOME)\include;$(JAVA_HOME)\include\win32;$(ProjectDir)\src\windows;%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
|
||||||
<Optimization>Disabled</Optimization> |
|
||||||
<FavorSizeOrSpeed>Speed</FavorSizeOrSpeed> |
|
||||||
<PreprocessorDefinitions>WIN64;_DEBUG;_WINDOWS;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
|
||||||
<MinimalRebuild>true</MinimalRebuild> |
|
||||||
<ExceptionHandling>Sync</ExceptionHandling> |
|
||||||
<BasicRuntimeChecks>EnableFastChecks</BasicRuntimeChecks> |
|
||||||
<RuntimeLibrary>MultiThreadedDebugDLL</RuntimeLibrary> |
|
||||||
<RuntimeTypeInfo>false</RuntimeTypeInfo> |
|
||||||
<PrecompiledHeader> |
|
||||||
</PrecompiledHeader> |
|
||||||
<WarningLevel>Level3</WarningLevel> |
|
||||||
<DebugInformationFormat>EditAndContinue</DebugInformationFormat> |
|
||||||
</ClCompile> |
|
||||||
<Link> |
|
||||||
<GenerateDebugInformation>true</GenerateDebugInformation> |
|
||||||
<SubSystem>Windows</SubSystem> |
|
||||||
<TargetMachine>MachineX64</TargetMachine> |
|
||||||
</Link> |
|
||||||
</ItemDefinitionGroup> |
|
||||||
<ItemGroup> |
|
||||||
<ClCompile Include=".\src\leveldbjni.cpp"/> |
|
||||||
<ClCompile Include=".\src\leveldbjni_stats.cpp"/> |
|
||||||
<ClCompile Include=".\src\leveldbjni_structs.cpp"/> |
|
||||||
<ClCompile Include=".\src\buffer.c"/> |
|
||||||
<ClCompile Include=".\src\hawtjni.c"/> |
|
||||||
</ItemGroup> |
|
||||||
<ItemDefinitionGroup> |
|
||||||
<ClCompile> |
|
||||||
<PreprocessorDefinitions>SNAPPY;LEVELDB_PLATFORM_WINDOWS;OS_WIN;%(PreprocessorDefinitions)</PreprocessorDefinitions> |
|
||||||
<AdditionalIncludeDirectories>$(LEVELDB_HOME);$(LEVELDB_HOME)\include;$(LEVELDB_HOME)\port\win;$(SNAPPY_HOME);%(AdditionalIncludeDirectories)</AdditionalIncludeDirectories> |
|
||||||
</ClCompile> |
|
||||||
</ItemDefinitionGroup> |
|
||||||
<ItemDefinitionGroup Condition="'$(Platform)'=='Win32'"> |
|
||||||
<Link> |
|
||||||
<AdditionalDependencies>shlwapi.lib;$(LEVELDB_HOME)\Release\leveldb.lib;%(AdditionalDependencies)</AdditionalDependencies> |
|
||||||
</Link> |
|
||||||
</ItemDefinitionGroup> |
|
||||||
<ItemDefinitionGroup Condition="'$(Platform)'=='x64'"> |
|
||||||
<Link> |
|
||||||
<AdditionalDependencies>shlwapi.lib;$(LEVELDB_HOME)\x64\Release\leveldb.lib;%(AdditionalDependencies)</AdditionalDependencies> |
|
||||||
</Link> |
|
||||||
</ItemDefinitionGroup> |
|
||||||
<Import Project="$(VCTargetsPath)\Microsoft.Cpp.targets" /> |
|
||||||
<ImportGroup Label="ExtensionTargets"> |
|
||||||
</ImportGroup> |
|
||||||
</Project> |
|
@ -1 +0,0 @@ |
|||||||
${project.version} |
|
@ -1,432 +0,0 @@ |
|||||||
/* |
|
||||||
* Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
* |
|
||||||
* http://fusesource.com
|
|
||||||
* |
|
||||||
* Redistribution and use in source and binary forms, with or without |
|
||||||
* modification, are permitted provided that the following conditions are |
|
||||||
* met: |
|
||||||
* |
|
||||||
* * Redistributions of source code must retain the above copyright |
|
||||||
* notice, this list of conditions and the following disclaimer. |
|
||||||
* * 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. |
|
||||||
* * Neither the name of FuseSource Corp. nor the names of its |
|
||||||
* contributors may be used to endorse or promote products derived from |
|
||||||
* this software without specific prior written permission. |
|
||||||
* |
|
||||||
* 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. |
|
||||||
*/ |
|
||||||
package org.fusesource.leveldbjni.test; |
|
||||||
|
|
||||||
import junit.framework.TestCase; |
|
||||||
import org.fusesource.leveldbjni.JniDBFactory; |
|
||||||
import org.fusesource.leveldbjni.internal.JniDB; |
|
||||||
import org.iq80.leveldb.*; |
|
||||||
import org.junit.Test; |
|
||||||
|
|
||||||
import java.io.File; |
|
||||||
import java.io.IOException; |
|
||||||
import java.util.*; |
|
||||||
|
|
||||||
import static org.fusesource.leveldbjni.JniDBFactory.asString; |
|
||||||
import static org.fusesource.leveldbjni.JniDBFactory.bytes; |
|
||||||
|
|
||||||
/** |
|
||||||
* A Unit test for the DB class implementation. |
|
||||||
* |
|
||||||
* @author <a href="http://hiramchirino.com">Hiram Chirino</a> |
|
||||||
*/ |
|
||||||
public class DBTest extends TestCase { |
|
||||||
DBFactory factory = JniDBFactory.factory; |
|
||||||
|
|
||||||
File getTestDirectory(String name) throws IOException { |
|
||||||
File rc = new File(new File("test-data"), name); |
|
||||||
factory.destroy(rc, new Options().createIfMissing(true)); |
|
||||||
rc.mkdirs(); |
|
||||||
return rc; |
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testOpen() throws IOException { |
|
||||||
|
|
||||||
Options options = new Options().createIfMissing(true); |
|
||||||
|
|
||||||
File path = getTestDirectory(getName()); |
|
||||||
DB db = factory.open(path, options); |
|
||||||
|
|
||||||
db.close(); |
|
||||||
|
|
||||||
// Try again.. this time we expect a failure since it exists.
|
|
||||||
options = new Options().errorIfExists(true); |
|
||||||
try { |
|
||||||
factory.open(path, options); |
|
||||||
fail("Expected exception."); |
|
||||||
} catch (IOException e) { |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testRepair() throws IOException, DBException { |
|
||||||
testCRUD(); |
|
||||||
factory.repair(new File(new File("test-data"), getName()), new Options()); |
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testCRUD() throws IOException, DBException { |
|
||||||
|
|
||||||
Options options = new Options().createIfMissing(true); |
|
||||||
|
|
||||||
File path = getTestDirectory(getName()); |
|
||||||
DB db = factory.open(path, options); |
|
||||||
|
|
||||||
WriteOptions wo = new WriteOptions().sync(false); |
|
||||||
ReadOptions ro = new ReadOptions().fillCache(true).verifyChecksums(true); |
|
||||||
|
|
||||||
db.put(bytes("Tampa"), bytes("green")); |
|
||||||
db.put(bytes("London"), bytes("red")); |
|
||||||
db.put(bytes("New York"), bytes("blue")); |
|
||||||
|
|
||||||
assertEquals(db.get(bytes("Tampa"), ro), bytes("green")); |
|
||||||
assertEquals(db.get(bytes("London"), ro), bytes("red")); |
|
||||||
assertEquals(db.get(bytes("New York"), ro), bytes("blue")); |
|
||||||
|
|
||||||
db.delete(bytes("New York"), wo); |
|
||||||
assertNull(db.get(bytes("New York"), ro)); |
|
||||||
|
|
||||||
// leveldb does not consider deleting something that does not exist an error.
|
|
||||||
db.delete(bytes("New York"), wo); |
|
||||||
|
|
||||||
db.close(); |
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testIterator() throws IOException, DBException { |
|
||||||
|
|
||||||
Options options = new Options().createIfMissing(true); |
|
||||||
|
|
||||||
File path = getTestDirectory(getName()); |
|
||||||
DB db = factory.open(path, options); |
|
||||||
|
|
||||||
db.put(bytes("Tampa"), bytes("green")); |
|
||||||
db.put(bytes("London"), bytes("red")); |
|
||||||
db.put(bytes("New York"), bytes("blue")); |
|
||||||
|
|
||||||
ArrayList<String> expecting = new ArrayList<String>(); |
|
||||||
expecting.add("London"); |
|
||||||
expecting.add("New York"); |
|
||||||
expecting.add("Tampa"); |
|
||||||
|
|
||||||
ArrayList<String> actual = new ArrayList<String>(); |
|
||||||
|
|
||||||
DBIterator iterator = db.iterator(); |
|
||||||
for (iterator.seekToFirst(); iterator.hasNext(); iterator.next()) { |
|
||||||
actual.add(asString(iterator.peekNext().getKey())); |
|
||||||
} |
|
||||||
iterator.close(); |
|
||||||
assertEquals(expecting, actual); |
|
||||||
|
|
||||||
db.close(); |
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testSnapshot() throws IOException, DBException { |
|
||||||
|
|
||||||
Options options = new Options().createIfMissing(true); |
|
||||||
|
|
||||||
File path = getTestDirectory(getName()); |
|
||||||
DB db = factory.open(path, options); |
|
||||||
|
|
||||||
db.put(bytes("Tampa"), bytes("green")); |
|
||||||
db.put(bytes("London"), bytes("red")); |
|
||||||
db.delete(bytes("New York")); |
|
||||||
|
|
||||||
ReadOptions ro = new ReadOptions().snapshot(db.getSnapshot()); |
|
||||||
|
|
||||||
db.put(bytes("New York"), bytes("blue")); |
|
||||||
|
|
||||||
assertEquals(db.get(bytes("Tampa"), ro), bytes("green")); |
|
||||||
assertEquals(db.get(bytes("London"), ro), bytes("red")); |
|
||||||
|
|
||||||
// Should not be able to get "New York" since it was added
|
|
||||||
// after the snapshot
|
|
||||||
assertNull(db.get(bytes("New York"), ro)); |
|
||||||
|
|
||||||
ro.snapshot().close(); |
|
||||||
|
|
||||||
// Now try again without the snapshot..
|
|
||||||
ro.snapshot(null); |
|
||||||
assertEquals(db.get(bytes("New York"), ro), bytes("blue")); |
|
||||||
|
|
||||||
db.close(); |
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testWriteBatch() throws IOException, DBException { |
|
||||||
|
|
||||||
Options options = new Options().createIfMissing(true); |
|
||||||
|
|
||||||
File path = getTestDirectory(getName()); |
|
||||||
DB db = factory.open(path, options); |
|
||||||
|
|
||||||
db.put(bytes("NA"), bytes("Na")); |
|
||||||
|
|
||||||
WriteBatch batch = db.createWriteBatch(); |
|
||||||
batch.delete(bytes("NA")); |
|
||||||
batch.put(bytes("Tampa"), bytes("green")); |
|
||||||
batch.put(bytes("London"), bytes("red")); |
|
||||||
batch.put(bytes("New York"), bytes("blue")); |
|
||||||
db.write(batch); |
|
||||||
batch.close(); |
|
||||||
|
|
||||||
ArrayList<String> expecting = new ArrayList<String>(); |
|
||||||
expecting.add("London"); |
|
||||||
expecting.add("New York"); |
|
||||||
expecting.add("Tampa"); |
|
||||||
|
|
||||||
ArrayList<String> actual = new ArrayList<String>(); |
|
||||||
|
|
||||||
DBIterator iterator = db.iterator(); |
|
||||||
for (iterator.seekToFirst(); iterator.hasNext(); iterator.next()) { |
|
||||||
actual.add(asString(iterator.peekNext().getKey())); |
|
||||||
} |
|
||||||
iterator.close(); |
|
||||||
assertEquals(expecting, actual); |
|
||||||
|
|
||||||
db.close(); |
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testApproximateSizes() throws IOException, DBException { |
|
||||||
Options options = new Options().createIfMissing(true); |
|
||||||
|
|
||||||
File path = getTestDirectory(getName()); |
|
||||||
DB db = factory.open(path, options); |
|
||||||
|
|
||||||
Random r = new Random(0); |
|
||||||
String data=""; |
|
||||||
for(int i=0; i < 1024; i++) { |
|
||||||
data+= 'a'+r.nextInt(26); |
|
||||||
} |
|
||||||
for(int i=0; i < 5*1024; i++) { |
|
||||||
db.put(bytes("row"+i), bytes(data)); |
|
||||||
} |
|
||||||
|
|
||||||
long[] approximateSizes = db.getApproximateSizes(new Range(bytes("row"), bytes("s"))); |
|
||||||
assertNotNull(approximateSizes); |
|
||||||
assertEquals(1, approximateSizes.length); |
|
||||||
assertTrue("Wrong size", approximateSizes[0] > 0); |
|
||||||
|
|
||||||
db.close(); |
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testGetProperty() throws IOException, DBException { |
|
||||||
Options options = new Options().createIfMissing(true); |
|
||||||
|
|
||||||
File path = getTestDirectory(getName()); |
|
||||||
DB db = factory.open(path, options); |
|
||||||
|
|
||||||
Random r = new Random(0); |
|
||||||
String data=""; |
|
||||||
for(int i=0; i < 1024; i++) { |
|
||||||
data+= 'a'+r.nextInt(26); |
|
||||||
} |
|
||||||
for(int i=0; i < 5*1024; i++) { |
|
||||||
db.put(bytes("row"+i), bytes(data)); |
|
||||||
} |
|
||||||
|
|
||||||
String stats = db.getProperty("leveldb.stats"); |
|
||||||
assertNotNull(stats); |
|
||||||
assertTrue(stats.contains("Compactions")); |
|
||||||
|
|
||||||
db.close(); |
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testCustomComparator1() throws IOException, DBException { |
|
||||||
Options options = new Options().createIfMissing(true); |
|
||||||
options.comparator(new DBComparator() { |
|
||||||
|
|
||||||
public int compare(byte[] key1, byte[] key2) { |
|
||||||
return new String(key1).compareTo(new String(key2)); |
|
||||||
} |
|
||||||
|
|
||||||
public String name() { |
|
||||||
return getName(); |
|
||||||
} |
|
||||||
|
|
||||||
public byte[] findShortestSeparator(byte[] start, byte[] limit) { |
|
||||||
return start; |
|
||||||
} |
|
||||||
|
|
||||||
public byte[] findShortSuccessor(byte[] key) { |
|
||||||
return key; |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
File path = getTestDirectory(getName()); |
|
||||||
DB db = factory.open(path, options); |
|
||||||
|
|
||||||
ArrayList<String> expecting = new ArrayList<String>(); |
|
||||||
for(int i=0; i < 26; i++) { |
|
||||||
String t = ""+ ((char) ('a' + i)); |
|
||||||
expecting.add(t); |
|
||||||
db.put(bytes(t), bytes(t)); |
|
||||||
} |
|
||||||
|
|
||||||
ArrayList<String> actual = new ArrayList<String>(); |
|
||||||
|
|
||||||
DBIterator iterator = db.iterator(); |
|
||||||
for (iterator.seekToFirst(); iterator.hasNext(); iterator.next()) { |
|
||||||
actual.add(asString(iterator.peekNext().getKey())); |
|
||||||
} |
|
||||||
iterator.close(); |
|
||||||
assertEquals(expecting, actual); |
|
||||||
|
|
||||||
|
|
||||||
db.close(); |
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testCustomComparator2() throws IOException, DBException { |
|
||||||
Options options = new Options().createIfMissing(true); |
|
||||||
options.comparator(new DBComparator() { |
|
||||||
|
|
||||||
public int compare(byte[] key1, byte[] key2) { |
|
||||||
return new String(key1).compareTo(new String(key2)) * -1; |
|
||||||
} |
|
||||||
|
|
||||||
public String name() { |
|
||||||
return getName(); |
|
||||||
} |
|
||||||
|
|
||||||
public byte[] findShortestSeparator(byte[] start, byte[] limit) { |
|
||||||
return start; |
|
||||||
} |
|
||||||
|
|
||||||
public byte[] findShortSuccessor(byte[] key) { |
|
||||||
return key; |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
File path = getTestDirectory(getName()); |
|
||||||
DB db = factory.open(path, options); |
|
||||||
|
|
||||||
ArrayList<String> expecting = new ArrayList<String>(); |
|
||||||
for(int i=0; i < 26; i++) { |
|
||||||
String t = ""+ ((char) ('a' + i)); |
|
||||||
expecting.add(t); |
|
||||||
db.put(bytes(t), bytes(t)); |
|
||||||
} |
|
||||||
Collections.reverse(expecting); |
|
||||||
|
|
||||||
ArrayList<String> actual = new ArrayList<String>(); |
|
||||||
DBIterator iterator = db.iterator(); |
|
||||||
for (iterator.seekToFirst(); iterator.hasNext(); iterator.next()) { |
|
||||||
actual.add(asString(iterator.peekNext().getKey())); |
|
||||||
} |
|
||||||
iterator.close(); |
|
||||||
assertEquals(expecting, actual); |
|
||||||
|
|
||||||
db.close(); |
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testLogger() throws IOException, InterruptedException, DBException { |
|
||||||
final List<String> messages = Collections.synchronizedList(new ArrayList<String>()); |
|
||||||
|
|
||||||
Options options = new Options().createIfMissing(true); |
|
||||||
options.logger(new Logger() { |
|
||||||
public void log(String message) { |
|
||||||
messages.add(message); |
|
||||||
} |
|
||||||
}); |
|
||||||
|
|
||||||
File path = getTestDirectory(getName()); |
|
||||||
DB db = factory.open(path, options); |
|
||||||
|
|
||||||
for( int j=0; j < 5; j++) { |
|
||||||
Random r = new Random(0); |
|
||||||
String data=""; |
|
||||||
for(int i=0; i < 1024; i++) { |
|
||||||
data+= 'a'+r.nextInt(26); |
|
||||||
} |
|
||||||
for(int i=0; i < 5*1024; i++) { |
|
||||||
db.put(bytes("row"+i), bytes(data)); |
|
||||||
} |
|
||||||
Thread.sleep(100); |
|
||||||
} |
|
||||||
|
|
||||||
db.close(); |
|
||||||
|
|
||||||
assertFalse(messages.isEmpty()); |
|
||||||
|
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testCompactRanges() throws IOException, InterruptedException, DBException { |
|
||||||
Options options = new Options().createIfMissing(true); |
|
||||||
File path = getTestDirectory(getName()); |
|
||||||
DB db = factory.open(path, options); |
|
||||||
if( db instanceof JniDB) { |
|
||||||
Random r = new Random(0); |
|
||||||
String data=""; |
|
||||||
for(int i=0; i < 1024; i++) { |
|
||||||
data+= 'a'+r.nextInt(26); |
|
||||||
} |
|
||||||
for(int i=0; i < 5*1024; i++) { |
|
||||||
db.put(bytes("row"+i), bytes(data)); |
|
||||||
} |
|
||||||
for(int i=0; i < 5*1024; i++) { |
|
||||||
db.delete(bytes("row" + i)); |
|
||||||
} |
|
||||||
|
|
||||||
String stats = db.getProperty("leveldb.stats"); |
|
||||||
System.out.println(stats); |
|
||||||
|
|
||||||
// Compactions
|
|
||||||
// Level Files Size(MB) Time(sec) Read(MB) Write(MB)
|
|
||||||
// --------------------------------------------------
|
|
||||||
assertFalse(stats.contains("1 0 0 0")); |
|
||||||
assertFalse(stats.contains("2 0 0 0")); |
|
||||||
|
|
||||||
// After the compaction, level 1 and 2 should not have any files in it..
|
|
||||||
((JniDB) db).compactRange(null, null); |
|
||||||
|
|
||||||
stats = db.getProperty("leveldb.stats"); |
|
||||||
System.out.println(stats); |
|
||||||
assertTrue(stats.contains("1 0 0 0")); |
|
||||||
assertTrue(stats.contains("2 0 0 0")); |
|
||||||
|
|
||||||
} |
|
||||||
db.close(); |
|
||||||
} |
|
||||||
|
|
||||||
@Test |
|
||||||
public void testSuspendAndResumeCompactions() throws Exception { |
|
||||||
Options options = new Options().createIfMissing(true); |
|
||||||
File path = getTestDirectory(getName()); |
|
||||||
DB db = factory.open(path, options); |
|
||||||
db.suspendCompactions(); |
|
||||||
db.resumeCompactions(); |
|
||||||
db.close(); |
|
||||||
} |
|
||||||
|
|
||||||
public void assertEquals(byte[] arg1, byte[] arg2) { |
|
||||||
assertTrue(Arrays.equals(arg1, arg2)); |
|
||||||
} |
|
||||||
} |
|
@ -1,27 +0,0 @@ |
|||||||
Copyright (c) 2011 FuseSource Corp. All rights reserved. |
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without |
|
||||||
modification, are permitted provided that the following conditions are |
|
||||||
met: |
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright |
|
||||||
notice, this list of conditions and the following disclaimer. |
|
||||||
* 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. |
|
||||||
* Neither the name of FuseSource Corp. nor the names of its |
|
||||||
contributors may be used to endorse or promote products derived from |
|
||||||
this software without specific prior written permission. |
|
||||||
|
|
||||||
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. |
|
@ -1,323 +0,0 @@ |
|||||||
<?xml version="1.0" encoding="UTF-8"?> |
|
||||||
<!-- |
|
||||||
Copyright (C) 2011, FuseSource Corp. All rights reserved. |
|
||||||
|
|
||||||
http://fusesource.com |
|
||||||
|
|
||||||
Redistribution and use in source and binary forms, with or without |
|
||||||
modification, are permitted provided that the following conditions are |
|
||||||
met: |
|
||||||
|
|
||||||
* Redistributions of source code must retain the above copyright |
|
||||||
notice, this list of conditions and the following disclaimer. |
|
||||||
* 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. |
|
||||||
* Neither the name of FuseSource Corp. nor the names of its |
|
||||||
contributors may be used to endorse or promote products derived from |
|
||||||
this software without specific prior written permission. |
|
||||||
|
|
||||||
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. |
|
||||||
--> |
|
||||||
<project xmlns="http://maven.apache.org/POM/4.0.0" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd"> |
|
||||||
|
|
||||||
<modelVersion>4.0.0</modelVersion> |
|
||||||
<parent> |
|
||||||
<groupId>org.fusesource</groupId> |
|
||||||
<artifactId>fusesource-pom</artifactId> |
|
||||||
<version>1.9</version> |
|
||||||
</parent> |
|
||||||
|
|
||||||
<groupId>org.fusesource.leveldbjni.fb</groupId> |
|
||||||
<artifactId>leveldbjni-project</artifactId> |
|
||||||
<version>1.5.7</version> |
|
||||||
<packaging>pom</packaging> |
|
||||||
|
|
||||||
<name>${project.artifactId}</name> |
|
||||||
<description>leveldbjni is a jni library for accessing leveldb.</description> |
|
||||||
|
|
||||||
<properties> |
|
||||||
<forge-project-id>leveldbjni</forge-project-id> |
|
||||||
<forge-project-id-uc>LEVELDBJNI</forge-project-id-uc> |
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding> |
|
||||||
<hawtjni-version>1.6</hawtjni-version> |
|
||||||
<leveldb-api-version>0.4</leveldb-api-version> |
|
||||||
<project.nexus.hostPort>nexus.vip.facebook.com:8181</project.nexus.hostPort> |
|
||||||
<project.java.version>1.7</project.java.version> |
|
||||||
<project.libs-releases-local-url> |
|
||||||
http://${project.nexus.hostPort}/nexus/content/repositories/libs-releases-local |
|
||||||
</project.libs-releases-local-url> |
|
||||||
<project.libs-snapshots-local-url> |
|
||||||
http://${project.nexus.hostPort}/nexus/content/repositories/libs-snapshots-local |
|
||||||
</project.libs-snapshots-local-url> |
|
||||||
</properties> |
|
||||||
|
|
||||||
<modules> |
|
||||||
<module>leveldbjni</module> |
|
||||||
</modules> |
|
||||||
|
|
||||||
<url>http://${forge-project-id}.fusesource.org</url> |
|
||||||
<inceptionYear>2009</inceptionYear> |
|
||||||
|
|
||||||
<issueManagement> |
|
||||||
<system>github</system> |
|
||||||
<url>https://github.com/fusesource/leveldbjni/issues</url> |
|
||||||
</issueManagement> |
|
||||||
|
|
||||||
<mailingLists> |
|
||||||
<mailingList> |
|
||||||
<name>${forge-project-id} dev</name> |
|
||||||
<post>${forge-project-id}-dev@fusesource.org</post> |
|
||||||
<subscribe>${forge-project-id}-dev-subscribe@fusesource.org</subscribe> |
|
||||||
</mailingList> |
|
||||||
<mailingList> |
|
||||||
<name>${forge-project-id} commits</name> |
|
||||||
<post>${forge-project-id}-commits@fusesource.org</post> |
|
||||||
<subscribe>${forge-project-id}-commits-subscribe@fusesource.org</subscribe> |
|
||||||
</mailingList> |
|
||||||
</mailingLists> |
|
||||||
|
|
||||||
<licenses> |
|
||||||
<license> |
|
||||||
<name>The BSD 3-Clause License</name> |
|
||||||
<url>http://www.opensource.org/licenses/BSD-3-Clause</url> |
|
||||||
<distribution>repo</distribution> |
|
||||||
</license> |
|
||||||
</licenses> |
|
||||||
|
|
||||||
<scm> |
|
||||||
<connection>scm:git:git://github.com/fusesource/leveldbjni.git</connection> |
|
||||||
<developerConnection>scm:git:git@github.com:fusesource/leveldbjni.git</developerConnection> |
|
||||||
<url>https://github.com/fusesource/leveldbjni</url> |
|
||||||
</scm> |
|
||||||
|
|
||||||
<distributionManagement> |
|
||||||
<repository> |
|
||||||
<id>libs-releases-local</id> |
|
||||||
<url>${project.libs-releases-local-url}</url> |
|
||||||
</repository> |
|
||||||
<snapshotRepository> |
|
||||||
<id>libs-snapshots-local</id> |
|
||||||
<url>${project.libs-snapshots-local-url}</url> |
|
||||||
</snapshotRepository> |
|
||||||
</distributionManagement> |
|
||||||
|
|
||||||
<developers> |
|
||||||
<developer> |
|
||||||
<id>chirino</id> |
|
||||||
<name>Hiram Chirino</name> |
|
||||||
<email>hiram@hiramchirino.com</email> |
|
||||||
<url>http://hiramchirino.com</url> |
|
||||||
<timezone>GMT-5</timezone> |
|
||||||
</developer> |
|
||||||
</developers> |
|
||||||
|
|
||||||
<dependencies> |
|
||||||
<dependency> |
|
||||||
<groupId>junit</groupId> |
|
||||||
<artifactId>junit</artifactId> |
|
||||||
<version>4.7</version> |
|
||||||
<scope>test</scope> |
|
||||||
</dependency> |
|
||||||
</dependencies> |
|
||||||
|
|
||||||
<build> |
|
||||||
<plugins> |
|
||||||
|
|
||||||
<!-- the older clean plugin has trouble deleting directories with symlinks in them --> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-clean-plugin</artifactId> |
|
||||||
<version>2.3</version> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-compiler-plugin</artifactId> |
|
||||||
<configuration> |
|
||||||
<source>1.5</source> |
|
||||||
<target>1.5</target> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
|
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-release-plugin</artifactId> |
|
||||||
<version>2.3.1</version> |
|
||||||
<configuration> |
|
||||||
<pushChanges>false</pushChanges> |
|
||||||
<localCheckout>true</localCheckout> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-surefire-plugin</artifactId> |
|
||||||
<version>2.4.3</version> |
|
||||||
<configuration> |
|
||||||
<redirectTestOutputToFile>true</redirectTestOutputToFile> |
|
||||||
<forkMode>once</forkMode> |
|
||||||
<argLine>-ea</argLine> |
|
||||||
<failIfNoTests>false</failIfNoTests> |
|
||||||
<workingDirectory>${project.build.directory}</workingDirectory> |
|
||||||
<includes> |
|
||||||
<include>**/*Test.java</include> |
|
||||||
</includes> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
</plugins> |
|
||||||
</build> |
|
||||||
|
|
||||||
<reporting> |
|
||||||
<plugins> |
|
||||||
<plugin> |
|
||||||
<groupId>org.codehaus.mojo</groupId> |
|
||||||
<artifactId>jxr-maven-plugin</artifactId> |
|
||||||
<version>2.0-beta-1</version> |
|
||||||
<configuration> |
|
||||||
<aggregate>true</aggregate> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-javadoc-plugin</artifactId> |
|
||||||
<version>2.6</version> |
|
||||||
<configuration> |
|
||||||
<excludePackageNames>*.internal</excludePackageNames> |
|
||||||
<linksource>true</linksource> |
|
||||||
<links> |
|
||||||
<link>http://java.sun.com/j2se/1.5.0/docs/api</link> |
|
||||||
</links> |
|
||||||
</configuration> |
|
||||||
</plugin> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-project-info-reports-plugin</artifactId> |
|
||||||
<version>2.1.1</version> |
|
||||||
<reportSets> |
|
||||||
<reportSet> |
|
||||||
<reports> |
|
||||||
<report>index</report> |
|
||||||
<report>sumary</report> |
|
||||||
<report>plugins</report> |
|
||||||
<report>dependencies</report> |
|
||||||
<report>mailing-list</report> |
|
||||||
<report>issue-tracking</report> |
|
||||||
<report>license</report> |
|
||||||
<report>scm</report> |
|
||||||
</reports> |
|
||||||
</reportSet> |
|
||||||
</reportSets> |
|
||||||
</plugin> |
|
||||||
<plugin> |
|
||||||
<groupId>org.codehaus.mojo</groupId> |
|
||||||
<artifactId>surefire-report-maven-plugin</artifactId> |
|
||||||
<version>2.0-beta-1</version> |
|
||||||
</plugin> |
|
||||||
<plugin> |
|
||||||
<groupId>org.apache.maven.plugins</groupId> |
|
||||||
<artifactId>maven-plugin-plugin</artifactId> |
|
||||||
<version>2.5</version> |
|
||||||
</plugin> |
|
||||||
</plugins> |
|
||||||
</reporting> |
|
||||||
|
|
||||||
<profiles> |
|
||||||
|
|
||||||
<profile> |
|
||||||
<id>download</id> |
|
||||||
<repositories> |
|
||||||
<repository> |
|
||||||
<id>fusesource.nexus.snapshot</id> |
|
||||||
<name>FuseSource Community Snapshot Repository</name> |
|
||||||
<url>http://repo.fusesource.com/nexus/content/groups/public-snapshots</url> |
|
||||||
</repository> |
|
||||||
<repository> |
|
||||||
<id>sonatype-nexus</id> |
|
||||||
<name>Sonatype Nexus</name> |
|
||||||
<url>https://oss.sonatype.org/content/repositories/public</url> |
|
||||||
<releases><enabled>true</enabled></releases> |
|
||||||
<snapshots><enabled>true</enabled></snapshots> |
|
||||||
</repository> |
|
||||||
</repositories> |
|
||||||
<pluginRepositories> |
|
||||||
<pluginRepository> |
|
||||||
<id>fusesource.nexus.snapshot</id> |
|
||||||
<name>FuseSource Community Snapshot Repository</name> |
|
||||||
<url>http://repo.fusesource.com/nexus/content/groups/public-snapshots</url> |
|
||||||
</pluginRepository> |
|
||||||
</pluginRepositories> |
|
||||||
</profile> |
|
||||||
|
|
||||||
<profile> |
|
||||||
<id>full</id> |
|
||||||
<modules> |
|
||||||
<module>leveldbjni-osx</module> |
|
||||||
<module>leveldbjni-linux32</module> |
|
||||||
<module>leveldbjni-linux64</module> |
|
||||||
<module>leveldbjni-win32</module> |
|
||||||
<module>leveldbjni-win64</module> |
|
||||||
<module>leveldbjni-all</module> |
|
||||||
</modules> |
|
||||||
</profile> |
|
||||||
|
|
||||||
<profile> |
|
||||||
<id>all</id> |
|
||||||
<modules> |
|
||||||
<module>leveldbjni-all</module> |
|
||||||
</modules> |
|
||||||
</profile> |
|
||||||
<profile> |
|
||||||
<id>osx</id> |
|
||||||
<modules> |
|
||||||
<module>leveldbjni-osx</module> |
|
||||||
</modules> |
|
||||||
</profile> |
|
||||||
|
|
||||||
<profile> |
|
||||||
<id>linux32</id> |
|
||||||
<modules> |
|
||||||
<module>leveldbjni-linux32</module> |
|
||||||
</modules> |
|
||||||
</profile> |
|
||||||
|
|
||||||
<profile> |
|
||||||
<id>linux64</id> |
|
||||||
<modules> |
|
||||||
<module>leveldbjni-linux64</module> |
|
||||||
</modules> |
|
||||||
</profile> |
|
||||||
|
|
||||||
<profile> |
|
||||||
<id>win32</id> |
|
||||||
<properties> |
|
||||||
<skipAutogen>true</skipAutogen> |
|
||||||
</properties> |
|
||||||
<modules> |
|
||||||
<module>leveldbjni-win32</module> |
|
||||||
</modules> |
|
||||||
</profile> |
|
||||||
|
|
||||||
<profile> |
|
||||||
<id>win64</id> |
|
||||||
<properties> |
|
||||||
<skipAutogen>true</skipAutogen> |
|
||||||
</properties> |
|
||||||
<modules> |
|
||||||
<module>leveldbjni-win64</module> |
|
||||||
</modules> |
|
||||||
</profile> |
|
||||||
|
|
||||||
</profiles> |
|
||||||
</project> |
|
@ -1,248 +0,0 @@ |
|||||||
# LevelDB JNI |
|
||||||
|
|
||||||
## Description |
|
||||||
|
|
||||||
LevelDB JNI gives you a Java interface to the |
|
||||||
[LevelDB](http://code.google.com/p/leveldb/) C++ library |
|
||||||
which is a fast key-value storage library written at Google |
|
||||||
that provides an ordered mapping from string keys to string values.. |
|
||||||
|
|
||||||
|
|
||||||
## Using as a Maven Dependency |
|
||||||
|
|
||||||
You just nee to add the following repositories and dependencies to your Maven pom. |
|
||||||
|
|
||||||
<repositories> |
|
||||||
<repository> |
|
||||||
<id>fusesource.nexus.snapshot</id> |
|
||||||
<name>FuseSource Community Snapshot Repository</name> |
|
||||||
<url>http://repo.fusesource.com/nexus/content/groups/public-snapshots</url> |
|
||||||
</repository> |
|
||||||
</repositories> |
|
||||||
|
|
||||||
<dependencies> |
|
||||||
<dependency> |
|
||||||
<groupId>org.fusesource.leveldbjni</groupId> |
|
||||||
<artifactId>leveldbjni-all</artifactId> |
|
||||||
<version>1.1</version> |
|
||||||
</dependency> |
|
||||||
</dependencies> |
|
||||||
|
|
||||||
## API Usage: |
|
||||||
|
|
||||||
Recommended Package imports: |
|
||||||
|
|
||||||
import org.iq80.leveldb.*; |
|
||||||
import static org.fusesource.leveldbjni.JniDBFactory.*; |
|
||||||
import java.io.*; |
|
||||||
|
|
||||||
Opening and closing the database. |
|
||||||
|
|
||||||
Options options = new Options(); |
|
||||||
options.createIfMissing(true); |
|
||||||
DB db = factory.open(new File("example"), options); |
|
||||||
try { |
|
||||||
// Use the db in here.... |
|
||||||
} finally { |
|
||||||
// Make sure you close the db to shutdown the |
|
||||||
// database and avoid resource leaks. |
|
||||||
db.close(); |
|
||||||
} |
|
||||||
|
|
||||||
Putting, Getting, and Deleting key/values. |
|
||||||
|
|
||||||
db.put(bytes("Tampa"), bytes("rocks")); |
|
||||||
String value = asString(db.get(bytes("Tampa"))); |
|
||||||
db.delete(wo, bytes("Tampa")); |
|
||||||
|
|
||||||
Performing Batch/Bulk/Atomic Updates. |
|
||||||
|
|
||||||
WriteBatch batch = db.createWriteBatch(); |
|
||||||
try { |
|
||||||
batch.delete(bytes("Denver")); |
|
||||||
batch.put(bytes("Tampa"), bytes("green")); |
|
||||||
batch.put(bytes("London"), bytes("red")); |
|
||||||
|
|
||||||
db.write(batch); |
|
||||||
} finally { |
|
||||||
// Make sure you close the batch to avoid resource leaks. |
|
||||||
batch.close(); |
|
||||||
} |
|
||||||
|
|
||||||
Iterating key/values. |
|
||||||
|
|
||||||
DBIterator iterator = db.iterator(); |
|
||||||
try { |
|
||||||
for(iterator.seekToFirst(); iterator.hasNext(); iterator.next()) { |
|
||||||
String key = asString(iterator.peekNext().getKey()); |
|
||||||
String value = asString(iterator.peekNext().getValue()); |
|
||||||
System.out.println(key+" = "+value); |
|
||||||
} |
|
||||||
} finally { |
|
||||||
// Make sure you close the iterator to avoid resource leaks. |
|
||||||
iterator.close(); |
|
||||||
} |
|
||||||
|
|
||||||
Working against a Snapshot view of the Database. |
|
||||||
|
|
||||||
ReadOptions ro = new ReadOptions(); |
|
||||||
ro.snapshot(db.getSnapshot()); |
|
||||||
try { |
|
||||||
|
|
||||||
// All read operations will now use the same |
|
||||||
// consistent view of the data. |
|
||||||
... = db.iterator(ro); |
|
||||||
... = db.get(bytes("Tampa"), ro); |
|
||||||
|
|
||||||
} finally { |
|
||||||
// Make sure you close the snapshot to avoid resource leaks. |
|
||||||
ro.snapshot().close(); |
|
||||||
} |
|
||||||
|
|
||||||
Using a custom Comparator. |
|
||||||
|
|
||||||
DBComparator comparator = new DBComparator(){ |
|
||||||
public int compare(byte[] key1, byte[] key2) { |
|
||||||
return new String(key1).compareTo(new String(key2)); |
|
||||||
} |
|
||||||
public String name() { |
|
||||||
return "simple"; |
|
||||||
} |
|
||||||
public byte[] findShortestSeparator(byte[] start, byte[] limit) { |
|
||||||
return start; |
|
||||||
} |
|
||||||
public byte[] findShortSuccessor(byte[] key) { |
|
||||||
return key; |
|
||||||
} |
|
||||||
}; |
|
||||||
Options options = new Options(); |
|
||||||
options.comparator(comparator); |
|
||||||
DB db = factory.open(new File("example"), options); |
|
||||||
|
|
||||||
Disabling Compression |
|
||||||
|
|
||||||
Options options = new Options(); |
|
||||||
options.compressionType(CompressionType.NONE); |
|
||||||
DB db = factory.open(new File("example"), options); |
|
||||||
|
|
||||||
Configuring the Cache |
|
||||||
|
|
||||||
Options options = new Options(); |
|
||||||
options.cacheSize(100 * 1048576); // 100MB cache |
|
||||||
DB db = factory.open(new File("example"), options); |
|
||||||
|
|
||||||
Getting approximate sizes. |
|
||||||
|
|
||||||
long[] sizes = db.getApproximateSizes(new Range(bytes("a"), bytes("k")), new Range(bytes("k"), bytes("z"))); |
|
||||||
System.out.println("Size: "+sizes[0]+", "+sizes[1]); |
|
||||||
|
|
||||||
Getting database status. |
|
||||||
|
|
||||||
String stats = db.getProperty("leveldb.stats"); |
|
||||||
System.out.println(stats); |
|
||||||
|
|
||||||
Getting informational log messages. |
|
||||||
|
|
||||||
Logger logger = new Logger() { |
|
||||||
public void log(String message) { |
|
||||||
System.out.println(message); |
|
||||||
} |
|
||||||
}; |
|
||||||
Options options = new Options(); |
|
||||||
options.logger(logger); |
|
||||||
DB db = factory.open(new File("example"), options); |
|
||||||
|
|
||||||
Destroying a database. |
|
||||||
|
|
||||||
Options options = new Options(); |
|
||||||
factory.destroy(new File("example"), options); |
|
||||||
|
|
||||||
Repairing a database. |
|
||||||
|
|
||||||
Options options = new Options(); |
|
||||||
factory.repair(new File("example"), options); |
|
||||||
|
|
||||||
Using a memory pool to make native memory allocations more efficient: |
|
||||||
|
|
||||||
JniDBFactory.pushMemoryPool(1024 * 512); |
|
||||||
try { |
|
||||||
// .. work with the DB in here, |
|
||||||
} finally { |
|
||||||
JniDBFactory.popMemoryPool(); |
|
||||||
} |
|
||||||
|
|
||||||
## Building |
|
||||||
|
|
||||||
### Prerequisites |
|
||||||
|
|
||||||
* GNU compiler toolchain |
|
||||||
* [Maven 3](http://maven.apache.org/download.html) |
|
||||||
|
|
||||||
### Supported Platforms |
|
||||||
|
|
||||||
The following worked for me on: |
|
||||||
|
|
||||||
* OS X Lion with X Code 4 |
|
||||||
* CentOS 5.6 (32 and 64 bit) |
|
||||||
* Ubuntu 12.04 (32 and 64 bit) |
|
||||||
* apt-get install autoconf libtool |
|
||||||
|
|
||||||
### Build Procedure |
|
||||||
|
|
||||||
Then download the snappy, leveldb, and leveldbjni project source code: |
|
||||||
|
|
||||||
wget http://snappy.googlecode.com/files/snappy-1.0.5.tar.gz |
|
||||||
tar -zxvf snappy-1.0.5.tar.gz |
|
||||||
git clone git://github.com/chirino/leveldb.git |
|
||||||
git clone git://github.com/fusesource/leveldbjni.git |
|
||||||
export SNAPPY_HOME=`cd snappy-1.0.5; pwd` |
|
||||||
export LEVELDB_HOME=`cd leveldb; pwd` |
|
||||||
export LEVELDBJNI_HOME=`cd leveldbjni; pwd` |
|
||||||
|
|
||||||
<!-- In cygwin that would be |
|
||||||
export SNAPPY_HOME=$(cygpath -w `cd snappy-1.0.5; pwd`) |
|
||||||
export LEVELDB_HOME=$(cygpath -w `cd leveldb; pwd`) |
|
||||||
export LEVELDBJNI_HOME=$(cygpath -w `cd leveldbjni; pwd`) |
|
||||||
--> |
|
||||||
|
|
||||||
Compile the snappy project. This produces a static library. |
|
||||||
|
|
||||||
cd ${SNAPPY_HOME} |
|
||||||
./configure --disable-shared --with-pic |
|
||||||
make |
|
||||||
|
|
||||||
Patch and Compile the leveldb project. This produces a static library. |
|
||||||
|
|
||||||
cd ${LEVELDB_HOME} |
|
||||||
export LIBRARY_PATH=${SNAPPY_HOME} |
|
||||||
export C_INCLUDE_PATH=${LIBRARY_PATH} |
|
||||||
export CPLUS_INCLUDE_PATH=${LIBRARY_PATH} |
|
||||||
git apply ../leveldbjni/leveldb.patch |
|
||||||
make libleveldb.a |
|
||||||
|
|
||||||
Now use maven to build the leveldbjni project. |
|
||||||
|
|
||||||
cd ${LEVELDBJNI_HOME} |
|
||||||
mvn clean install -P download -P ${platform} |
|
||||||
|
|
||||||
Replace ${platform} with one of the following platform identifiers (depending on the platform your building on): |
|
||||||
|
|
||||||
* osx |
|
||||||
* linux32 |
|
||||||
* linux64 |
|
||||||
* win32 |
|
||||||
* win64 |
|
||||||
|
|
||||||
If your platform does not have the right auto-tools levels available |
|
||||||
just copy the `leveldbjni-${version}-SNAPSHOT-native-src.zip` artifact |
|
||||||
from a platform the does have the tools available then add the |
|
||||||
following argument to your maven build: |
|
||||||
|
|
||||||
-Dnative-src-url=file:leveldbjni-${verision}-SNAPSHOT-native-src.zip |
|
||||||
|
|
||||||
### Build Results |
|
||||||
|
|
||||||
* `leveldbjni/target/leveldbjni-${version}.jar` : The java class file to the library. |
|
||||||
* `leveldbjni/target/leveldbjni-${version}-native-src.zip` : A GNU style source project which you can use to build the native library on other systems. |
|
||||||
* `leveldbjni-${platform}/target/leveldbjni-${platform}-${version}.jar` : A jar file containing the built native library using your currently platform. |
|
||||||
|
|
@ -1,30 +0,0 @@ |
|||||||
# How To Release |
|
||||||
|
|
||||||
Since levedbjni has to be build against multiple platforms, the standard maven release plugin will not work to do the release. |
|
||||||
|
|
||||||
Once you ready to do the release, create a branch for the release using: |
|
||||||
|
|
||||||
git co -b ${version}.x |
|
||||||
|
|
||||||
Update the version number in the poms using: |
|
||||||
|
|
||||||
mvn -P all org.codehaus.mojo:versions-maven-plugin:1.2:set org.codehaus.mojo:versions-maven-plugin:1.2:commit -DnewVersion="${version}" |
|
||||||
git commit -am "Preping for a the ${version} release" |
|
||||||
git tag "leveldbjni-${version}" |
|
||||||
git push origin "leveldbjni-${version}" |
|
||||||
|
|
||||||
Now release the non-platform specific artifacts using: |
|
||||||
|
|
||||||
mvn clean deploy -P release -P download |
|
||||||
|
|
||||||
Then for each platform, shell into the box check out the "leveldbjni-${version}" tag and then: |
|
||||||
|
|
||||||
cd $platform |
|
||||||
mvn clean deploy -Dleveldb=`cd ../../leveldb; pwd` -Dsnappy=`cd ../../snappy-1.0.3; pwd` -P release -P download |
|
||||||
|
|
||||||
Finally release the `leveldbjni-all` which uber jars all the previously released artifacts. |
|
||||||
|
|
||||||
cd leveldbjni-all |
|
||||||
mvn clean deploy -P release -P download |
|
||||||
|
|
||||||
Congrats your done. Make sure your releasing the artifacts in Nexus after each step. |
|
File diff suppressed because it is too large
Load Diff
@ -1,593 +0,0 @@ |
|||||||
/**
|
|
||||||
* Autogenerated by Thrift |
|
||||||
* |
|
||||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING |
|
||||||
* @generated |
|
||||||
*/ |
|
||||||
#ifndef _Tleveldb_scribe_H |
|
||||||
#define _Tleveldb_scribe_H |
|
||||||
|
|
||||||
#include <TDispatchProcessor.h> |
|
||||||
#include "scribe_types.h" |
|
||||||
|
|
||||||
namespace Tleveldb { |
|
||||||
|
|
||||||
class scribeIf { |
|
||||||
public: |
|
||||||
virtual ~scribeIf() {} |
|
||||||
virtual ResultCode Log(const std::vector<LogEntry> & messages) = 0; |
|
||||||
virtual void LogMulti(std::vector<ResultCode> & _return, const std::vector<LogEntry> & messages) = 0; |
|
||||||
virtual ResultCode LogCompressedMsg(const std::string& compressedMessages) = 0; |
|
||||||
}; |
|
||||||
|
|
||||||
class scribeIfFactory { |
|
||||||
public: |
|
||||||
typedef scribeIf Handler; |
|
||||||
|
|
||||||
virtual ~scribeIfFactory() {} |
|
||||||
|
|
||||||
virtual scribeIf* getHandler(::apache::thrift::server::TConnectionContext* ctx) = 0; |
|
||||||
virtual void releaseHandler(scribeIf* handler) = 0; |
|
||||||
}; |
|
||||||
|
|
||||||
class scribeIfSingletonFactory : virtual public scribeIfFactory { |
|
||||||
public: |
|
||||||
scribeIfSingletonFactory(const boost::shared_ptr<scribeIf>& iface) : iface_(iface) {} |
|
||||||
virtual ~scribeIfSingletonFactory() {} |
|
||||||
|
|
||||||
virtual scribeIf* getHandler(::apache::thrift::server::TConnectionContext*) { |
|
||||||
return iface_.get(); |
|
||||||
} |
|
||||||
virtual void releaseHandler(scribeIf* handler) {} |
|
||||||
|
|
||||||
protected: |
|
||||||
boost::shared_ptr<scribeIf> iface_; |
|
||||||
}; |
|
||||||
|
|
||||||
class scribeNull : virtual public scribeIf { |
|
||||||
public: |
|
||||||
virtual ~scribeNull() {} |
|
||||||
ResultCode Log(const std::vector<LogEntry> & /* messages */) { |
|
||||||
ResultCode _return = (ResultCode)0; |
|
||||||
return _return; |
|
||||||
} |
|
||||||
void LogMulti(std::vector<ResultCode> & /* _return */, const std::vector<LogEntry> & /* messages */) { |
|
||||||
return; |
|
||||||
} |
|
||||||
ResultCode LogCompressedMsg(const std::string& /* compressedMessages */) { |
|
||||||
ResultCode _return = (ResultCode)0; |
|
||||||
return _return; |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
class scribe_Log_args { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 5902265217339133004U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
scribe_Log_args() { |
|
||||||
} |
|
||||||
|
|
||||||
scribe_Log_args(const scribe_Log_args&) = default; |
|
||||||
scribe_Log_args& operator=(const scribe_Log_args&) = default; |
|
||||||
scribe_Log_args(scribe_Log_args&&) = default; |
|
||||||
scribe_Log_args& operator=(scribe_Log_args&&) = default; |
|
||||||
|
|
||||||
void __clear() { |
|
||||||
messages.clear(); |
|
||||||
__isset.__clear(); |
|
||||||
} |
|
||||||
|
|
||||||
virtual ~scribe_Log_args() throw() {} |
|
||||||
|
|
||||||
std::vector<LogEntry> messages; |
|
||||||
|
|
||||||
struct __isset { |
|
||||||
__isset() { __clear(); } |
|
||||||
void __clear() { |
|
||||||
messages = false; |
|
||||||
} |
|
||||||
bool messages; |
|
||||||
} __isset; |
|
||||||
|
|
||||||
bool operator == (const scribe_Log_args & rhs) const |
|
||||||
{ |
|
||||||
if (!(this->messages == rhs.messages)) |
|
||||||
return false; |
|
||||||
return true; |
|
||||||
} |
|
||||||
bool operator != (const scribe_Log_args &rhs) const { |
|
||||||
return !(*this == rhs); |
|
||||||
} |
|
||||||
|
|
||||||
bool operator < (const scribe_Log_args & ) const; |
|
||||||
|
|
||||||
uint32_t read(apache::thrift::protocol::TProtocol* iprot); |
|
||||||
uint32_t write(apache::thrift::protocol::TProtocol* oprot) const; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class scribe_Log_pargs { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 5555604010648986412U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
|
|
||||||
virtual ~scribe_Log_pargs() throw() {} |
|
||||||
|
|
||||||
const std::vector<LogEntry> * messages; |
|
||||||
|
|
||||||
uint32_t write(apache::thrift::protocol::TProtocol* oprot) const; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class scribe_Log_result { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 18205781396971565932U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
scribe_Log_result() : success(static_cast<ResultCode>(0)) { |
|
||||||
} |
|
||||||
|
|
||||||
scribe_Log_result(const scribe_Log_result&) = default; |
|
||||||
scribe_Log_result& operator=(const scribe_Log_result&) = default; |
|
||||||
scribe_Log_result(scribe_Log_result&&) = default; |
|
||||||
scribe_Log_result& operator=(scribe_Log_result&&) = default; |
|
||||||
|
|
||||||
void __clear() { |
|
||||||
success = static_cast<ResultCode>(0); |
|
||||||
__isset.__clear(); |
|
||||||
} |
|
||||||
|
|
||||||
virtual ~scribe_Log_result() throw() {} |
|
||||||
|
|
||||||
ResultCode success; |
|
||||||
|
|
||||||
struct __isset { |
|
||||||
__isset() { __clear(); } |
|
||||||
void __clear() { |
|
||||||
success = false; |
|
||||||
} |
|
||||||
bool success; |
|
||||||
} __isset; |
|
||||||
|
|
||||||
bool operator == (const scribe_Log_result & rhs) const |
|
||||||
{ |
|
||||||
if (!(this->success == rhs.success)) |
|
||||||
return false; |
|
||||||
return true; |
|
||||||
} |
|
||||||
bool operator != (const scribe_Log_result &rhs) const { |
|
||||||
return !(*this == rhs); |
|
||||||
} |
|
||||||
|
|
||||||
bool operator < (const scribe_Log_result & ) const; |
|
||||||
|
|
||||||
uint32_t read(apache::thrift::protocol::TProtocol* iprot); |
|
||||||
uint32_t write(apache::thrift::protocol::TProtocol* oprot) const; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class scribe_Log_presult { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 12945584136895385836U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
|
|
||||||
virtual ~scribe_Log_presult() throw() {} |
|
||||||
|
|
||||||
ResultCode* success; |
|
||||||
|
|
||||||
struct __isset { |
|
||||||
__isset() { __clear(); } |
|
||||||
void __clear() { |
|
||||||
success = false; |
|
||||||
} |
|
||||||
bool success; |
|
||||||
} __isset; |
|
||||||
|
|
||||||
uint32_t read(apache::thrift::protocol::TProtocol* iprot); |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class scribe_LogMulti_args { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 7590876486278061516U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
scribe_LogMulti_args() { |
|
||||||
} |
|
||||||
|
|
||||||
scribe_LogMulti_args(const scribe_LogMulti_args&) = default; |
|
||||||
scribe_LogMulti_args& operator=(const scribe_LogMulti_args&) = default; |
|
||||||
scribe_LogMulti_args(scribe_LogMulti_args&&) = default; |
|
||||||
scribe_LogMulti_args& operator=(scribe_LogMulti_args&&) = default; |
|
||||||
|
|
||||||
void __clear() { |
|
||||||
messages.clear(); |
|
||||||
__isset.__clear(); |
|
||||||
} |
|
||||||
|
|
||||||
virtual ~scribe_LogMulti_args() throw() {} |
|
||||||
|
|
||||||
std::vector<LogEntry> messages; |
|
||||||
|
|
||||||
struct __isset { |
|
||||||
__isset() { __clear(); } |
|
||||||
void __clear() { |
|
||||||
messages = false; |
|
||||||
} |
|
||||||
bool messages; |
|
||||||
} __isset; |
|
||||||
|
|
||||||
bool operator == (const scribe_LogMulti_args & rhs) const |
|
||||||
{ |
|
||||||
if (!(this->messages == rhs.messages)) |
|
||||||
return false; |
|
||||||
return true; |
|
||||||
} |
|
||||||
bool operator != (const scribe_LogMulti_args &rhs) const { |
|
||||||
return !(*this == rhs); |
|
||||||
} |
|
||||||
|
|
||||||
bool operator < (const scribe_LogMulti_args & ) const; |
|
||||||
|
|
||||||
uint32_t read(apache::thrift::protocol::TProtocol* iprot); |
|
||||||
uint32_t write(apache::thrift::protocol::TProtocol* oprot) const; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class scribe_LogMulti_pargs { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 9124384543551655628U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
|
|
||||||
virtual ~scribe_LogMulti_pargs() throw() {} |
|
||||||
|
|
||||||
const std::vector<LogEntry> * messages; |
|
||||||
|
|
||||||
uint32_t write(apache::thrift::protocol::TProtocol* oprot) const; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class scribe_LogMulti_result { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 4828367046341273164U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
scribe_LogMulti_result() { |
|
||||||
} |
|
||||||
|
|
||||||
scribe_LogMulti_result(const scribe_LogMulti_result&) = default; |
|
||||||
scribe_LogMulti_result& operator=(const scribe_LogMulti_result&) = default; |
|
||||||
scribe_LogMulti_result(scribe_LogMulti_result&&) = default; |
|
||||||
scribe_LogMulti_result& operator=(scribe_LogMulti_result&&) = default; |
|
||||||
|
|
||||||
void __clear() { |
|
||||||
success.clear(); |
|
||||||
__isset.__clear(); |
|
||||||
} |
|
||||||
|
|
||||||
virtual ~scribe_LogMulti_result() throw() {} |
|
||||||
|
|
||||||
std::vector<ResultCode> success; |
|
||||||
|
|
||||||
struct __isset { |
|
||||||
__isset() { __clear(); } |
|
||||||
void __clear() { |
|
||||||
success = false; |
|
||||||
} |
|
||||||
bool success; |
|
||||||
} __isset; |
|
||||||
|
|
||||||
bool operator == (const scribe_LogMulti_result & rhs) const |
|
||||||
{ |
|
||||||
if (!(this->success == rhs.success)) |
|
||||||
return false; |
|
||||||
return true; |
|
||||||
} |
|
||||||
bool operator != (const scribe_LogMulti_result &rhs) const { |
|
||||||
return !(*this == rhs); |
|
||||||
} |
|
||||||
|
|
||||||
bool operator < (const scribe_LogMulti_result & ) const; |
|
||||||
|
|
||||||
uint32_t read(apache::thrift::protocol::TProtocol* iprot); |
|
||||||
uint32_t write(apache::thrift::protocol::TProtocol* oprot) const; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class scribe_LogMulti_presult { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 5642041737363050316U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
|
|
||||||
virtual ~scribe_LogMulti_presult() throw() {} |
|
||||||
|
|
||||||
std::vector<ResultCode> * success; |
|
||||||
|
|
||||||
struct __isset { |
|
||||||
__isset() { __clear(); } |
|
||||||
void __clear() { |
|
||||||
success = false; |
|
||||||
} |
|
||||||
bool success; |
|
||||||
} __isset; |
|
||||||
|
|
||||||
uint32_t read(apache::thrift::protocol::TProtocol* iprot); |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class scribe_LogCompressedMsg_args { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 12705053036625273964U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
scribe_LogCompressedMsg_args() : compressedMessages("") { |
|
||||||
} |
|
||||||
|
|
||||||
scribe_LogCompressedMsg_args(const scribe_LogCompressedMsg_args&) = default; |
|
||||||
scribe_LogCompressedMsg_args& operator=(const scribe_LogCompressedMsg_args&) = default; |
|
||||||
scribe_LogCompressedMsg_args(scribe_LogCompressedMsg_args&&) = default; |
|
||||||
scribe_LogCompressedMsg_args& operator=(scribe_LogCompressedMsg_args&&) = default; |
|
||||||
|
|
||||||
void __clear() { |
|
||||||
compressedMessages = ""; |
|
||||||
__isset.__clear(); |
|
||||||
} |
|
||||||
|
|
||||||
virtual ~scribe_LogCompressedMsg_args() throw() {} |
|
||||||
|
|
||||||
std::string compressedMessages; |
|
||||||
|
|
||||||
struct __isset { |
|
||||||
__isset() { __clear(); } |
|
||||||
void __clear() { |
|
||||||
compressedMessages = false; |
|
||||||
} |
|
||||||
bool compressedMessages; |
|
||||||
} __isset; |
|
||||||
|
|
||||||
bool operator == (const scribe_LogCompressedMsg_args & rhs) const |
|
||||||
{ |
|
||||||
if (!(this->compressedMessages == rhs.compressedMessages)) |
|
||||||
return false; |
|
||||||
return true; |
|
||||||
} |
|
||||||
bool operator != (const scribe_LogCompressedMsg_args &rhs) const { |
|
||||||
return !(*this == rhs); |
|
||||||
} |
|
||||||
|
|
||||||
bool operator < (const scribe_LogCompressedMsg_args & ) const; |
|
||||||
|
|
||||||
uint32_t read(apache::thrift::protocol::TProtocol* iprot); |
|
||||||
uint32_t write(apache::thrift::protocol::TProtocol* oprot) const; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class scribe_LogCompressedMsg_pargs { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 13645577436870531500U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
|
|
||||||
virtual ~scribe_LogCompressedMsg_pargs() throw() {} |
|
||||||
|
|
||||||
const std::string* compressedMessages; |
|
||||||
|
|
||||||
uint32_t write(apache::thrift::protocol::TProtocol* oprot) const; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class scribe_LogCompressedMsg_result { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 15026639991904524972U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
scribe_LogCompressedMsg_result() : success(static_cast<ResultCode>(0)) { |
|
||||||
} |
|
||||||
|
|
||||||
scribe_LogCompressedMsg_result(const scribe_LogCompressedMsg_result&) = default; |
|
||||||
scribe_LogCompressedMsg_result& operator=(const scribe_LogCompressedMsg_result&) = default; |
|
||||||
scribe_LogCompressedMsg_result(scribe_LogCompressedMsg_result&&) = default; |
|
||||||
scribe_LogCompressedMsg_result& operator=(scribe_LogCompressedMsg_result&&) = default; |
|
||||||
|
|
||||||
void __clear() { |
|
||||||
success = static_cast<ResultCode>(0); |
|
||||||
__isset.__clear(); |
|
||||||
} |
|
||||||
|
|
||||||
virtual ~scribe_LogCompressedMsg_result() throw() {} |
|
||||||
|
|
||||||
ResultCode success; |
|
||||||
|
|
||||||
struct __isset { |
|
||||||
__isset() { __clear(); } |
|
||||||
void __clear() { |
|
||||||
success = false; |
|
||||||
} |
|
||||||
bool success; |
|
||||||
} __isset; |
|
||||||
|
|
||||||
bool operator == (const scribe_LogCompressedMsg_result & rhs) const |
|
||||||
{ |
|
||||||
if (!(this->success == rhs.success)) |
|
||||||
return false; |
|
||||||
return true; |
|
||||||
} |
|
||||||
bool operator != (const scribe_LogCompressedMsg_result &rhs) const { |
|
||||||
return !(*this == rhs); |
|
||||||
} |
|
||||||
|
|
||||||
bool operator < (const scribe_LogCompressedMsg_result & ) const; |
|
||||||
|
|
||||||
uint32_t read(apache::thrift::protocol::TProtocol* iprot); |
|
||||||
uint32_t write(apache::thrift::protocol::TProtocol* oprot) const; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class scribe_LogCompressedMsg_presult { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 5311776576442573772U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
|
|
||||||
virtual ~scribe_LogCompressedMsg_presult() throw() {} |
|
||||||
|
|
||||||
ResultCode* success; |
|
||||||
|
|
||||||
struct __isset { |
|
||||||
__isset() { __clear(); } |
|
||||||
void __clear() { |
|
||||||
success = false; |
|
||||||
} |
|
||||||
bool success; |
|
||||||
} __isset; |
|
||||||
|
|
||||||
uint32_t read(apache::thrift::protocol::TProtocol* iprot); |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class scribeClient : virtual public scribeIf, virtual public apache::thrift::TClientBase { |
|
||||||
public: |
|
||||||
scribeClient(boost::shared_ptr<apache::thrift::protocol::TProtocol> prot) : |
|
||||||
checkSeqid_(true), |
|
||||||
nextSendSequenceId_(1), |
|
||||||
nextRecvSequenceId_(1), |
|
||||||
piprot_(prot), |
|
||||||
poprot_(prot) { |
|
||||||
iprot_ = prot.get(); |
|
||||||
oprot_ = prot.get(); |
|
||||||
} |
|
||||||
scribeClient(boost::shared_ptr<apache::thrift::protocol::TProtocol> iprot, boost::shared_ptr<apache::thrift::protocol::TProtocol> oprot) : |
|
||||||
checkSeqid_(true), |
|
||||||
nextSendSequenceId_(1), |
|
||||||
nextRecvSequenceId_(1), |
|
||||||
piprot_(iprot), |
|
||||||
poprot_(oprot) { |
|
||||||
iprot_ = iprot.get(); |
|
||||||
oprot_ = oprot.get(); |
|
||||||
} |
|
||||||
boost::shared_ptr<apache::thrift::protocol::TProtocol> getInputProtocol() { |
|
||||||
return piprot_; |
|
||||||
} |
|
||||||
boost::shared_ptr<apache::thrift::protocol::TProtocol> getOutputProtocol() { |
|
||||||
return poprot_; |
|
||||||
} |
|
||||||
ResultCode Log(const std::vector<LogEntry> & messages); |
|
||||||
void send_Log(const std::vector<LogEntry> & messages); |
|
||||||
ResultCode recv_Log(); |
|
||||||
void LogMulti(std::vector<ResultCode> & _return, const std::vector<LogEntry> & messages); |
|
||||||
void send_LogMulti(const std::vector<LogEntry> & messages); |
|
||||||
void recv_LogMulti(std::vector<ResultCode> & _return); |
|
||||||
ResultCode LogCompressedMsg(const std::string& compressedMessages); |
|
||||||
void send_LogCompressedMsg(const std::string& compressedMessages); |
|
||||||
ResultCode recv_LogCompressedMsg(); |
|
||||||
|
|
||||||
/**
|
|
||||||
* Disable checking the seqid field in server responses. |
|
||||||
* |
|
||||||
* This should only be used with broken servers that return incorrect seqid values. |
|
||||||
*/ |
|
||||||
void _disableSequenceIdChecks() { |
|
||||||
checkSeqid_ = false; |
|
||||||
} |
|
||||||
|
|
||||||
protected: |
|
||||||
bool checkSeqid_; |
|
||||||
int32_t nextSendSequenceId_; |
|
||||||
int32_t nextRecvSequenceId_; |
|
||||||
int32_t getNextSendSequenceId(); |
|
||||||
int32_t getNextRecvSequenceId(); |
|
||||||
boost::shared_ptr<apache::thrift::protocol::TProtocol> piprot_; |
|
||||||
boost::shared_ptr<apache::thrift::protocol::TProtocol> poprot_; |
|
||||||
apache::thrift::protocol::TProtocol* iprot_; |
|
||||||
apache::thrift::protocol::TProtocol* oprot_; |
|
||||||
}; |
|
||||||
|
|
||||||
class scribeProcessor : public ::apache::thrift::TDispatchProcessor { |
|
||||||
protected: |
|
||||||
boost::shared_ptr<scribeIf> iface_; |
|
||||||
virtual bool dispatchCall(apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot, const std::string& fname, int32_t seqid, apache::thrift::server::TConnectionContext* connectionContext); |
|
||||||
private: |
|
||||||
typedef void (scribeProcessor::*ProcessFunction)(int32_t, apache::thrift::protocol::TProtocol*, apache::thrift::protocol::TProtocol*, apache::thrift::server::TConnectionContext*); |
|
||||||
typedef std::map<std::string, ProcessFunction> ProcessMap; |
|
||||||
ProcessMap processMap_; |
|
||||||
void process_Log(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot, apache::thrift::server::TConnectionContext* connectionContext); |
|
||||||
void process_LogMulti(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot, apache::thrift::server::TConnectionContext* connectionContext); |
|
||||||
void process_LogCompressedMsg(int32_t seqid, apache::thrift::protocol::TProtocol* iprot, apache::thrift::protocol::TProtocol* oprot, apache::thrift::server::TConnectionContext* connectionContext); |
|
||||||
public: |
|
||||||
scribeProcessor(boost::shared_ptr<scribeIf> iface) : |
|
||||||
iface_(iface) { |
|
||||||
processMap_["Log"] = &scribeProcessor::process_Log; |
|
||||||
processMap_["LogMulti"] = &scribeProcessor::process_LogMulti; |
|
||||||
processMap_["LogCompressedMsg"] = &scribeProcessor::process_LogCompressedMsg; |
|
||||||
} |
|
||||||
|
|
||||||
virtual ~scribeProcessor() {} |
|
||||||
|
|
||||||
boost::shared_ptr<std::set<std::string> > getProcessFunctions() { |
|
||||||
boost::shared_ptr<std::set<std::string> > rSet(new std::set<std::string>()); |
|
||||||
rSet->insert("scribe.Log"); |
|
||||||
rSet->insert("scribe.LogMulti"); |
|
||||||
rSet->insert("scribe.LogCompressedMsg"); |
|
||||||
return rSet; |
|
||||||
} |
|
||||||
}; |
|
||||||
|
|
||||||
class scribeProcessorFactory : public ::apache::thrift::TProcessorFactory { |
|
||||||
public: |
|
||||||
scribeProcessorFactory(const ::boost::shared_ptr< scribeIfFactory >& handlerFactory) : |
|
||||||
handlerFactory_(handlerFactory) {} |
|
||||||
|
|
||||||
::boost::shared_ptr< ::apache::thrift::TProcessor > getProcessor(::apache::thrift::server::TConnectionContext* ctx); |
|
||||||
|
|
||||||
protected: |
|
||||||
::boost::shared_ptr< scribeIfFactory > handlerFactory_; |
|
||||||
}; |
|
||||||
|
|
||||||
class scribeMultiface : virtual public scribeIf { |
|
||||||
public: |
|
||||||
scribeMultiface(std::vector<boost::shared_ptr<scribeIf> >& ifaces) : ifaces_(ifaces) { |
|
||||||
} |
|
||||||
virtual ~scribeMultiface() {} |
|
||||||
protected: |
|
||||||
std::vector<boost::shared_ptr<scribeIf> > ifaces_; |
|
||||||
scribeMultiface() {} |
|
||||||
void add(boost::shared_ptr<scribeIf> iface) { |
|
||||||
ifaces_.push_back(iface); |
|
||||||
} |
|
||||||
public: |
|
||||||
ResultCode Log(const std::vector<LogEntry> & messages) { |
|
||||||
uint32_t i; |
|
||||||
uint32_t sz = ifaces_.size(); |
|
||||||
for (i = 0; i < sz - 1; ++i) { |
|
||||||
ifaces_[i]->Log(messages); |
|
||||||
} |
|
||||||
return ifaces_[i]->Log(messages); |
|
||||||
} |
|
||||||
|
|
||||||
void LogMulti(std::vector<ResultCode> & _return, const std::vector<LogEntry> & messages) { |
|
||||||
uint32_t i; |
|
||||||
uint32_t sz = ifaces_.size(); |
|
||||||
for (i = 0; i < sz; ++i) { |
|
||||||
ifaces_[i]->LogMulti(_return, messages); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
ResultCode LogCompressedMsg(const std::string& compressedMessages) { |
|
||||||
uint32_t i; |
|
||||||
uint32_t sz = ifaces_.size(); |
|
||||||
for (i = 0; i < sz - 1; ++i) { |
|
||||||
ifaces_[i]->LogCompressedMsg(compressedMessages); |
|
||||||
} |
|
||||||
return ifaces_[i]->LogCompressedMsg(compressedMessages); |
|
||||||
} |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#endif |
|
@ -1,17 +0,0 @@ |
|||||||
/**
|
|
||||||
* Autogenerated by Thrift |
|
||||||
* |
|
||||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING |
|
||||||
* @generated |
|
||||||
*/ |
|
||||||
#include "scribe_constants.h" |
|
||||||
|
|
||||||
namespace Tleveldb { |
|
||||||
|
|
||||||
const scribeConstants g_scribe_constants; |
|
||||||
|
|
||||||
scribeConstants::scribeConstants() { |
|
||||||
SCRIBE_MAX_MESSAGE_LENGTH = 26214400; |
|
||||||
} |
|
||||||
|
|
||||||
} // namespace
|
|
@ -1,25 +0,0 @@ |
|||||||
/**
|
|
||||||
* Autogenerated by Thrift |
|
||||||
* |
|
||||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING |
|
||||||
* @generated |
|
||||||
*/ |
|
||||||
#ifndef scribe_CONSTANTS_H |
|
||||||
#define scribe_CONSTANTS_H |
|
||||||
|
|
||||||
#include "scribe_types.h" |
|
||||||
|
|
||||||
namespace Tleveldb { |
|
||||||
|
|
||||||
class scribeConstants { |
|
||||||
public: |
|
||||||
scribeConstants(); |
|
||||||
|
|
||||||
int32_t SCRIBE_MAX_MESSAGE_LENGTH; |
|
||||||
}; |
|
||||||
|
|
||||||
extern const scribeConstants g_scribe_constants; |
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#endif |
|
@ -1,513 +0,0 @@ |
|||||||
/**
|
|
||||||
* Autogenerated by Thrift |
|
||||||
* |
|
||||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING |
|
||||||
* @generated |
|
||||||
*/ |
|
||||||
#include "scribe_types.h" |
|
||||||
|
|
||||||
#include <thrift/lib/cpp/Reflection.h> |
|
||||||
#include <algorithm> |
|
||||||
#include <string.h> |
|
||||||
|
|
||||||
namespace Tleveldb { |
|
||||||
|
|
||||||
int _kResultCodeValues[] = { |
|
||||||
OK, |
|
||||||
TRY_LATER, |
|
||||||
ERROR_DECOMPRESS |
|
||||||
}; |
|
||||||
|
|
||||||
const char* _kResultCodeNames[] = { |
|
||||||
"OK", |
|
||||||
"TRY_LATER", |
|
||||||
"ERROR_DECOMPRESS" |
|
||||||
}; |
|
||||||
|
|
||||||
const std::map<int, const char*> _ResultCode_VALUES_TO_NAMES(apache::thrift::TEnumIterator<int>(3, _kResultCodeValues, _kResultCodeNames), apache::thrift::TEnumIterator<int>(-1, NULL, NULL)); |
|
||||||
|
|
||||||
const std::map<const char*, int, apache::thrift::ltstr> _ResultCode_NAMES_TO_VALUES(apache::thrift::TEnumInverseIterator<int>(3, _kResultCodeValues, _kResultCodeNames), apache::thrift::TEnumInverseIterator<int>(-1, NULL, NULL)); |
|
||||||
|
|
||||||
} // namespace
|
|
||||||
namespace apache { namespace thrift { |
|
||||||
template<> |
|
||||||
const char* TEnumTraits< ::Trocksdb::ResultCode>::findName( ::Trocksdb::ResultCode value) { |
|
||||||
return findName( ::Trocksdb::_ResultCode_VALUES_TO_NAMES, value); |
|
||||||
} |
|
||||||
|
|
||||||
template<> |
|
||||||
bool TEnumTraits< ::Trocksdb::ResultCode>::findValue(const char* name, ::Trocksdb::ResultCode* out) { |
|
||||||
return findValue( ::Trocksdb::_ResultCode_NAMES_TO_VALUES, name, out); |
|
||||||
} |
|
||||||
}} // apache::thrift
|
|
||||||
|
|
||||||
namespace Tleveldb { |
|
||||||
// Reflection initializer for struct scribe.SourceInfo
|
|
||||||
namespace { |
|
||||||
void reflectionInitializer_16557823557777806572(::apache::thrift::reflection::Schema& schema) { |
|
||||||
const uint64_t id = 16557823557777806572U; |
|
||||||
if (schema.dataTypes.count(id)) return; |
|
||||||
::apache::thrift::reflection::DataType dt; |
|
||||||
dt.name = "struct scribe.SourceInfo"; |
|
||||||
dt.__isset.fields = true; |
|
||||||
{ |
|
||||||
::apache::thrift::reflection::StructField f; |
|
||||||
f.isRequired = true; |
|
||||||
f.type = 1U; |
|
||||||
f.name = "host"; |
|
||||||
dt.fields[1] = f; |
|
||||||
} |
|
||||||
{ |
|
||||||
::apache::thrift::reflection::StructField f; |
|
||||||
f.isRequired = true; |
|
||||||
f.type = 5U; |
|
||||||
f.name = "port"; |
|
||||||
dt.fields[2] = f; |
|
||||||
} |
|
||||||
{ |
|
||||||
::apache::thrift::reflection::StructField f; |
|
||||||
f.isRequired = true; |
|
||||||
f.type = 6U; |
|
||||||
f.name = "timestamp"; |
|
||||||
dt.fields[3] = f; |
|
||||||
} |
|
||||||
schema.dataTypes[id] = dt; |
|
||||||
schema.names[dt.name] = id; |
|
||||||
} |
|
||||||
} // namespace
|
|
||||||
|
|
||||||
const uint64_t SourceInfo::_reflection_id; |
|
||||||
void SourceInfo::_reflection_register(::apache::thrift::reflection::Schema& schema) { |
|
||||||
reflectionInitializer_16557823557777806572(schema); |
|
||||||
} |
|
||||||
uint32_t SourceInfo::read(apache::thrift::protocol::TProtocol* iprot) { |
|
||||||
|
|
||||||
uint32_t xfer = 0; |
|
||||||
std::string fname; |
|
||||||
apache::thrift::protocol::TType ftype; |
|
||||||
int16_t fid; |
|
||||||
|
|
||||||
xfer += iprot->readStructBegin(fname); |
|
||||||
|
|
||||||
using apache::thrift::protocol::TProtocolException; |
|
||||||
|
|
||||||
|
|
||||||
while (true) |
|
||||||
{ |
|
||||||
xfer += iprot->readFieldBegin(fname, ftype, fid); |
|
||||||
if (ftype == apache::thrift::protocol::T_STOP) { |
|
||||||
break; |
|
||||||
} |
|
||||||
switch (fid) |
|
||||||
{ |
|
||||||
case 1: |
|
||||||
if (ftype == apache::thrift::protocol::T_STRING) { |
|
||||||
xfer += iprot->readBinary(this->host); |
|
||||||
this->__isset.host = true; |
|
||||||
} else { |
|
||||||
xfer += iprot->skip(ftype); |
|
||||||
} |
|
||||||
break; |
|
||||||
case 2: |
|
||||||
if (ftype == apache::thrift::protocol::T_I32) { |
|
||||||
xfer += iprot->readI32(this->port); |
|
||||||
this->__isset.port = true; |
|
||||||
} else { |
|
||||||
xfer += iprot->skip(ftype); |
|
||||||
} |
|
||||||
break; |
|
||||||
case 3: |
|
||||||
if (ftype == apache::thrift::protocol::T_I64) { |
|
||||||
xfer += iprot->readI64(this->timestamp); |
|
||||||
this->__isset.timestamp = true; |
|
||||||
} else { |
|
||||||
xfer += iprot->skip(ftype); |
|
||||||
} |
|
||||||
break; |
|
||||||
default: |
|
||||||
xfer += iprot->skip(ftype); |
|
||||||
break; |
|
||||||
} |
|
||||||
xfer += iprot->readFieldEnd(); |
|
||||||
} |
|
||||||
|
|
||||||
xfer += iprot->readStructEnd(); |
|
||||||
|
|
||||||
return xfer; |
|
||||||
} |
|
||||||
|
|
||||||
uint32_t SourceInfo::write(apache::thrift::protocol::TProtocol* oprot) const { |
|
||||||
uint32_t xfer = 0; |
|
||||||
xfer += oprot->writeStructBegin("SourceInfo"); |
|
||||||
xfer += oprot->writeFieldBegin("host", apache::thrift::protocol::T_STRING, 1); |
|
||||||
xfer += oprot->writeBinary(this->host); |
|
||||||
xfer += oprot->writeFieldEnd(); |
|
||||||
xfer += oprot->writeFieldBegin("port", apache::thrift::protocol::T_I32, 2); |
|
||||||
xfer += oprot->writeI32(this->port); |
|
||||||
xfer += oprot->writeFieldEnd(); |
|
||||||
xfer += oprot->writeFieldBegin("timestamp", apache::thrift::protocol::T_I64, 3); |
|
||||||
xfer += oprot->writeI64(this->timestamp); |
|
||||||
xfer += oprot->writeFieldEnd(); |
|
||||||
xfer += oprot->writeFieldStop(); |
|
||||||
xfer += oprot->writeStructEnd(); |
|
||||||
return xfer; |
|
||||||
} |
|
||||||
|
|
||||||
void swap(SourceInfo &a, SourceInfo &b) { |
|
||||||
using ::std::swap; |
|
||||||
(void)a; |
|
||||||
(void)b; |
|
||||||
swap(a.host, b.host); |
|
||||||
swap(a.port, b.port); |
|
||||||
swap(a.timestamp, b.timestamp); |
|
||||||
swap(a.__isset, b.__isset); |
|
||||||
} |
|
||||||
|
|
||||||
// Reflection initializer for map<string, string>
|
|
||||||
namespace { |
|
||||||
void reflectionInitializer_9246346592659763371(::apache::thrift::reflection::Schema& schema) { |
|
||||||
const uint64_t id = 9246346592659763371U; |
|
||||||
if (schema.dataTypes.count(id)) return; |
|
||||||
::apache::thrift::reflection::DataType dt; |
|
||||||
dt.name = "map<string, string>"; |
|
||||||
dt.__isset.mapKeyType = true; |
|
||||||
dt.mapKeyType = 1U; |
|
||||||
dt.__isset.valueType = true; |
|
||||||
dt.valueType = 1U; |
|
||||||
schema.dataTypes[id] = dt; |
|
||||||
schema.names[dt.name] = id; |
|
||||||
} |
|
||||||
} // namespace
|
|
||||||
|
|
||||||
// Reflection initializer for struct scribe.LogEntry
|
|
||||||
namespace { |
|
||||||
void reflectionInitializer_15053466696968532300(::apache::thrift::reflection::Schema& schema) { |
|
||||||
const uint64_t id = 15053466696968532300U; |
|
||||||
if (schema.dataTypes.count(id)) return; |
|
||||||
reflectionInitializer_16557823557777806572(schema); // struct scribe.SourceInfo
|
|
||||||
reflectionInitializer_9246346592659763371(schema); // map<string, string>
|
|
||||||
::apache::thrift::reflection::DataType dt; |
|
||||||
dt.name = "struct scribe.LogEntry"; |
|
||||||
dt.__isset.fields = true; |
|
||||||
{ |
|
||||||
::apache::thrift::reflection::StructField f; |
|
||||||
f.isRequired = true; |
|
||||||
f.type = 1U; |
|
||||||
f.name = "category"; |
|
||||||
dt.fields[1] = f; |
|
||||||
} |
|
||||||
{ |
|
||||||
::apache::thrift::reflection::StructField f; |
|
||||||
f.isRequired = true; |
|
||||||
f.type = 1U; |
|
||||||
f.name = "message"; |
|
||||||
dt.fields[2] = f; |
|
||||||
} |
|
||||||
{ |
|
||||||
::apache::thrift::reflection::StructField f; |
|
||||||
f.isRequired = false; |
|
||||||
f.type = 9246346592659763371U; |
|
||||||
f.name = "metadata"; |
|
||||||
dt.fields[3] = f; |
|
||||||
} |
|
||||||
{ |
|
||||||
::apache::thrift::reflection::StructField f; |
|
||||||
f.isRequired = false; |
|
||||||
f.type = 5U; |
|
||||||
f.name = "checksum"; |
|
||||||
dt.fields[4] = f; |
|
||||||
} |
|
||||||
{ |
|
||||||
::apache::thrift::reflection::StructField f; |
|
||||||
f.isRequired = false; |
|
||||||
f.type = 16557823557777806572U; |
|
||||||
f.name = "source"; |
|
||||||
dt.fields[5] = f; |
|
||||||
} |
|
||||||
{ |
|
||||||
::apache::thrift::reflection::StructField f; |
|
||||||
f.isRequired = false; |
|
||||||
f.type = 5U; |
|
||||||
f.name = "bucket"; |
|
||||||
dt.fields[6] = f; |
|
||||||
} |
|
||||||
schema.dataTypes[id] = dt; |
|
||||||
schema.names[dt.name] = id; |
|
||||||
} |
|
||||||
} // namespace
|
|
||||||
|
|
||||||
const uint64_t LogEntry::_reflection_id; |
|
||||||
void LogEntry::_reflection_register(::apache::thrift::reflection::Schema& schema) { |
|
||||||
reflectionInitializer_15053466696968532300(schema); |
|
||||||
} |
|
||||||
uint32_t LogEntry::read(apache::thrift::protocol::TProtocol* iprot) { |
|
||||||
|
|
||||||
uint32_t xfer = 0; |
|
||||||
std::string fname; |
|
||||||
apache::thrift::protocol::TType ftype; |
|
||||||
int16_t fid; |
|
||||||
|
|
||||||
xfer += iprot->readStructBegin(fname); |
|
||||||
|
|
||||||
using apache::thrift::protocol::TProtocolException; |
|
||||||
|
|
||||||
|
|
||||||
while (true) |
|
||||||
{ |
|
||||||
xfer += iprot->readFieldBegin(fname, ftype, fid); |
|
||||||
if (ftype == apache::thrift::protocol::T_STOP) { |
|
||||||
break; |
|
||||||
} |
|
||||||
switch (fid) |
|
||||||
{ |
|
||||||
case 1: |
|
||||||
if (ftype == apache::thrift::protocol::T_STRING) { |
|
||||||
xfer += iprot->readBinary(this->category); |
|
||||||
this->__isset.category = true; |
|
||||||
} else { |
|
||||||
xfer += iprot->skip(ftype); |
|
||||||
} |
|
||||||
break; |
|
||||||
case 2: |
|
||||||
if (ftype == apache::thrift::protocol::T_STRING) { |
|
||||||
xfer += iprot->readBinary(this->message); |
|
||||||
this->__isset.message = true; |
|
||||||
} else { |
|
||||||
xfer += iprot->skip(ftype); |
|
||||||
} |
|
||||||
break; |
|
||||||
case 3: |
|
||||||
if (ftype == apache::thrift::protocol::T_MAP) { |
|
||||||
{ |
|
||||||
this->metadata.clear(); |
|
||||||
uint32_t _size0; |
|
||||||
apache::thrift::protocol::TType _ktype1; |
|
||||||
apache::thrift::protocol::TType _vtype2; |
|
||||||
xfer += iprot->readMapBegin(_ktype1, _vtype2, _size0); |
|
||||||
uint32_t _i4; |
|
||||||
for (_i4 = 0; _i4 < _size0; ++_i4) |
|
||||||
{ |
|
||||||
std::string _key5; |
|
||||||
xfer += iprot->readString(_key5); |
|
||||||
std::string& _val6 = this->metadata[_key5]; |
|
||||||
xfer += iprot->readString(_val6); |
|
||||||
} |
|
||||||
xfer += iprot->readMapEnd(); |
|
||||||
} |
|
||||||
this->__isset.metadata = true; |
|
||||||
} else { |
|
||||||
xfer += iprot->skip(ftype); |
|
||||||
} |
|
||||||
break; |
|
||||||
case 4: |
|
||||||
if (ftype == apache::thrift::protocol::T_I32) { |
|
||||||
xfer += iprot->readI32(this->checksum); |
|
||||||
this->__isset.checksum = true; |
|
||||||
} else { |
|
||||||
xfer += iprot->skip(ftype); |
|
||||||
} |
|
||||||
break; |
|
||||||
case 5: |
|
||||||
if (ftype == apache::thrift::protocol::T_STRUCT) { |
|
||||||
xfer += this->source.read(iprot); |
|
||||||
this->__isset.source = true; |
|
||||||
} else { |
|
||||||
xfer += iprot->skip(ftype); |
|
||||||
} |
|
||||||
break; |
|
||||||
case 6: |
|
||||||
if (ftype == apache::thrift::protocol::T_I32) { |
|
||||||
xfer += iprot->readI32(this->bucket); |
|
||||||
this->__isset.bucket = true; |
|
||||||
} else { |
|
||||||
xfer += iprot->skip(ftype); |
|
||||||
} |
|
||||||
break; |
|
||||||
default: |
|
||||||
xfer += iprot->skip(ftype); |
|
||||||
break; |
|
||||||
} |
|
||||||
xfer += iprot->readFieldEnd(); |
|
||||||
} |
|
||||||
|
|
||||||
xfer += iprot->readStructEnd(); |
|
||||||
|
|
||||||
return xfer; |
|
||||||
} |
|
||||||
|
|
||||||
uint32_t LogEntry::write(apache::thrift::protocol::TProtocol* oprot) const { |
|
||||||
uint32_t xfer = 0; |
|
||||||
xfer += oprot->writeStructBegin("LogEntry"); |
|
||||||
xfer += oprot->writeFieldBegin("category", apache::thrift::protocol::T_STRING, 1); |
|
||||||
xfer += oprot->writeBinary(this->category); |
|
||||||
xfer += oprot->writeFieldEnd(); |
|
||||||
xfer += oprot->writeFieldBegin("message", apache::thrift::protocol::T_STRING, 2); |
|
||||||
xfer += oprot->writeBinary(this->message); |
|
||||||
xfer += oprot->writeFieldEnd(); |
|
||||||
if (this->__isset.metadata) { |
|
||||||
xfer += oprot->writeFieldBegin("metadata", apache::thrift::protocol::T_MAP, 3); |
|
||||||
{ |
|
||||||
xfer += oprot->writeMapBegin(apache::thrift::protocol::T_STRING, apache::thrift::protocol::T_STRING, this->metadata.size()); |
|
||||||
std::map<std::string, std::string> ::const_iterator _iter7; |
|
||||||
for (_iter7 = this->metadata.begin(); _iter7 != this->metadata.end(); ++_iter7) |
|
||||||
{ |
|
||||||
xfer += oprot->writeString(_iter7->first); |
|
||||||
xfer += oprot->writeString(_iter7->second); |
|
||||||
} |
|
||||||
xfer += oprot->writeMapEnd(); |
|
||||||
} |
|
||||||
xfer += oprot->writeFieldEnd(); |
|
||||||
} |
|
||||||
if (this->__isset.checksum) { |
|
||||||
xfer += oprot->writeFieldBegin("checksum", apache::thrift::protocol::T_I32, 4); |
|
||||||
xfer += oprot->writeI32(this->checksum); |
|
||||||
xfer += oprot->writeFieldEnd(); |
|
||||||
} |
|
||||||
if (this->__isset.source) { |
|
||||||
xfer += oprot->writeFieldBegin("source", apache::thrift::protocol::T_STRUCT, 5); |
|
||||||
xfer += this->source.write(oprot); |
|
||||||
xfer += oprot->writeFieldEnd(); |
|
||||||
} |
|
||||||
if (this->__isset.bucket) { |
|
||||||
xfer += oprot->writeFieldBegin("bucket", apache::thrift::protocol::T_I32, 6); |
|
||||||
xfer += oprot->writeI32(this->bucket); |
|
||||||
xfer += oprot->writeFieldEnd(); |
|
||||||
} |
|
||||||
xfer += oprot->writeFieldStop(); |
|
||||||
xfer += oprot->writeStructEnd(); |
|
||||||
return xfer; |
|
||||||
} |
|
||||||
|
|
||||||
void swap(LogEntry &a, LogEntry &b) { |
|
||||||
using ::std::swap; |
|
||||||
(void)a; |
|
||||||
(void)b; |
|
||||||
swap(a.category, b.category); |
|
||||||
swap(a.message, b.message); |
|
||||||
swap(a.metadata, b.metadata); |
|
||||||
swap(a.checksum, b.checksum); |
|
||||||
swap(a.source, b.source); |
|
||||||
swap(a.bucket, b.bucket); |
|
||||||
swap(a.__isset, b.__isset); |
|
||||||
} |
|
||||||
|
|
||||||
// Reflection initializer for list<struct scribe.LogEntry>
|
|
||||||
namespace { |
|
||||||
void reflectionInitializer_10251729064312664553(::apache::thrift::reflection::Schema& schema) { |
|
||||||
const uint64_t id = 10251729064312664553U; |
|
||||||
if (schema.dataTypes.count(id)) return; |
|
||||||
reflectionInitializer_15053466696968532300(schema); // struct scribe.LogEntry
|
|
||||||
::apache::thrift::reflection::DataType dt; |
|
||||||
dt.name = "list<struct scribe.LogEntry>"; |
|
||||||
dt.__isset.valueType = true; |
|
||||||
dt.valueType = 15053466696968532300U; |
|
||||||
schema.dataTypes[id] = dt; |
|
||||||
schema.names[dt.name] = id; |
|
||||||
} |
|
||||||
} // namespace
|
|
||||||
|
|
||||||
// Reflection initializer for struct scribe.MessageList
|
|
||||||
namespace { |
|
||||||
void reflectionInitializer_5674270912483072844(::apache::thrift::reflection::Schema& schema) { |
|
||||||
const uint64_t id = 5674270912483072844U; |
|
||||||
if (schema.dataTypes.count(id)) return; |
|
||||||
reflectionInitializer_10251729064312664553(schema); // list<struct scribe.LogEntry>
|
|
||||||
::apache::thrift::reflection::DataType dt; |
|
||||||
dt.name = "struct scribe.MessageList"; |
|
||||||
dt.__isset.fields = true; |
|
||||||
{ |
|
||||||
::apache::thrift::reflection::StructField f; |
|
||||||
f.isRequired = true; |
|
||||||
f.type = 10251729064312664553U; |
|
||||||
f.name = "messages"; |
|
||||||
dt.fields[1] = f; |
|
||||||
} |
|
||||||
schema.dataTypes[id] = dt; |
|
||||||
schema.names[dt.name] = id; |
|
||||||
} |
|
||||||
} // namespace
|
|
||||||
|
|
||||||
const uint64_t MessageList::_reflection_id; |
|
||||||
void MessageList::_reflection_register(::apache::thrift::reflection::Schema& schema) { |
|
||||||
reflectionInitializer_5674270912483072844(schema); |
|
||||||
} |
|
||||||
uint32_t MessageList::read(apache::thrift::protocol::TProtocol* iprot) { |
|
||||||
|
|
||||||
uint32_t xfer = 0; |
|
||||||
std::string fname; |
|
||||||
apache::thrift::protocol::TType ftype; |
|
||||||
int16_t fid; |
|
||||||
|
|
||||||
xfer += iprot->readStructBegin(fname); |
|
||||||
|
|
||||||
using apache::thrift::protocol::TProtocolException; |
|
||||||
|
|
||||||
|
|
||||||
while (true) |
|
||||||
{ |
|
||||||
xfer += iprot->readFieldBegin(fname, ftype, fid); |
|
||||||
if (ftype == apache::thrift::protocol::T_STOP) { |
|
||||||
break; |
|
||||||
} |
|
||||||
switch (fid) |
|
||||||
{ |
|
||||||
case 1: |
|
||||||
if (ftype == apache::thrift::protocol::T_LIST) { |
|
||||||
{ |
|
||||||
this->messages.clear(); |
|
||||||
uint32_t _size8; |
|
||||||
apache::thrift::protocol::TType _etype11; |
|
||||||
xfer += iprot->readListBegin(_etype11, _size8); |
|
||||||
this->messages.resize(_size8); |
|
||||||
uint32_t _i12; |
|
||||||
for (_i12 = 0; _i12 < _size8; ++_i12) |
|
||||||
{ |
|
||||||
xfer += this->messages[_i12].read(iprot); |
|
||||||
} |
|
||||||
xfer += iprot->readListEnd(); |
|
||||||
} |
|
||||||
this->__isset.messages = true; |
|
||||||
} else { |
|
||||||
xfer += iprot->skip(ftype); |
|
||||||
} |
|
||||||
break; |
|
||||||
default: |
|
||||||
xfer += iprot->skip(ftype); |
|
||||||
break; |
|
||||||
} |
|
||||||
xfer += iprot->readFieldEnd(); |
|
||||||
} |
|
||||||
|
|
||||||
xfer += iprot->readStructEnd(); |
|
||||||
|
|
||||||
return xfer; |
|
||||||
} |
|
||||||
|
|
||||||
uint32_t MessageList::write(apache::thrift::protocol::TProtocol* oprot) const { |
|
||||||
uint32_t xfer = 0; |
|
||||||
xfer += oprot->writeStructBegin("MessageList"); |
|
||||||
xfer += oprot->writeFieldBegin("messages", apache::thrift::protocol::T_LIST, 1); |
|
||||||
{ |
|
||||||
xfer += oprot->writeListBegin(apache::thrift::protocol::T_STRUCT, this->messages.size()); |
|
||||||
std::vector<LogEntry> ::const_iterator _iter13; |
|
||||||
for (_iter13 = this->messages.begin(); _iter13 != this->messages.end(); ++_iter13) |
|
||||||
{ |
|
||||||
xfer += (*_iter13).write(oprot); |
|
||||||
} |
|
||||||
xfer += oprot->writeListEnd(); |
|
||||||
} |
|
||||||
xfer += oprot->writeFieldEnd(); |
|
||||||
xfer += oprot->writeFieldStop(); |
|
||||||
xfer += oprot->writeStructEnd(); |
|
||||||
return xfer; |
|
||||||
} |
|
||||||
|
|
||||||
void swap(MessageList &a, MessageList &b) { |
|
||||||
using ::std::swap; |
|
||||||
(void)a; |
|
||||||
(void)b; |
|
||||||
swap(a.messages, b.messages); |
|
||||||
swap(a.__isset, b.__isset); |
|
||||||
} |
|
||||||
|
|
||||||
} // namespace
|
|
@ -1,247 +0,0 @@ |
|||||||
/**
|
|
||||||
* Autogenerated by Thrift |
|
||||||
* |
|
||||||
* DO NOT EDIT UNLESS YOU ARE SURE THAT YOU KNOW WHAT YOU ARE DOING |
|
||||||
* @generated |
|
||||||
*/ |
|
||||||
#ifndef scribe_TYPES_H |
|
||||||
#define scribe_TYPES_H |
|
||||||
|
|
||||||
#include <Thrift.h> |
|
||||||
#include <TApplicationException.h> |
|
||||||
#include <protocol/TProtocol.h> |
|
||||||
#include <transport/TTransport.h> |
|
||||||
|
|
||||||
namespace apache { namespace thrift { namespace reflection { |
|
||||||
class Schema; |
|
||||||
}}} |
|
||||||
|
|
||||||
|
|
||||||
namespace Tleveldb { |
|
||||||
|
|
||||||
enum ResultCode { |
|
||||||
OK = 0, |
|
||||||
TRY_LATER = 1, |
|
||||||
ERROR_DECOMPRESS = 2 |
|
||||||
}; |
|
||||||
|
|
||||||
extern const std::map<int, const char*> _ResultCode_VALUES_TO_NAMES; |
|
||||||
|
|
||||||
extern const std::map<const char*, int, apache::thrift::ltstr> _ResultCode_NAMES_TO_VALUES; |
|
||||||
|
|
||||||
} // namespace
|
|
||||||
namespace apache { namespace thrift { |
|
||||||
template<> |
|
||||||
inline constexpr ::Trocksdb::ResultCode TEnumTraits< ::Trocksdb::ResultCode>::min() { |
|
||||||
return ::Trocksdb::ResultCode::OK; |
|
||||||
} |
|
||||||
template<> |
|
||||||
inline constexpr ::Trocksdb::ResultCode TEnumTraits< ::Trocksdb::ResultCode>::max() { |
|
||||||
return ::Trocksdb::ResultCode::ERROR_DECOMPRESS; |
|
||||||
} |
|
||||||
}} // apache:thrift
|
|
||||||
|
|
||||||
namespace Tleveldb { |
|
||||||
class SourceInfo { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 16557823557777806572U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
SourceInfo() : host(""), port(0), timestamp(0) { |
|
||||||
} |
|
||||||
|
|
||||||
SourceInfo(const SourceInfo&) = default; |
|
||||||
SourceInfo& operator=(const SourceInfo&) = default; |
|
||||||
SourceInfo(SourceInfo&&) = default; |
|
||||||
SourceInfo& operator=(SourceInfo&&) = default; |
|
||||||
|
|
||||||
void __clear() { |
|
||||||
host = ""; |
|
||||||
port = 0; |
|
||||||
timestamp = 0; |
|
||||||
__isset.__clear(); |
|
||||||
} |
|
||||||
|
|
||||||
virtual ~SourceInfo() throw() {} |
|
||||||
|
|
||||||
std::string host; |
|
||||||
int32_t port; |
|
||||||
int64_t timestamp; |
|
||||||
|
|
||||||
struct __isset { |
|
||||||
__isset() { __clear(); } |
|
||||||
void __clear() { |
|
||||||
host = false; |
|
||||||
port = false; |
|
||||||
timestamp = false; |
|
||||||
} |
|
||||||
bool host; |
|
||||||
bool port; |
|
||||||
bool timestamp; |
|
||||||
} __isset; |
|
||||||
|
|
||||||
bool operator == (const SourceInfo & rhs) const |
|
||||||
{ |
|
||||||
if (!(this->host == rhs.host)) |
|
||||||
return false; |
|
||||||
if (!(this->port == rhs.port)) |
|
||||||
return false; |
|
||||||
if (!(this->timestamp == rhs.timestamp)) |
|
||||||
return false; |
|
||||||
return true; |
|
||||||
} |
|
||||||
bool operator != (const SourceInfo &rhs) const { |
|
||||||
return !(*this == rhs); |
|
||||||
} |
|
||||||
|
|
||||||
bool operator < (const SourceInfo & ) const; |
|
||||||
|
|
||||||
uint32_t read(apache::thrift::protocol::TProtocol* iprot); |
|
||||||
uint32_t write(apache::thrift::protocol::TProtocol* oprot) const; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class SourceInfo; |
|
||||||
void swap(SourceInfo &a, SourceInfo &b); |
|
||||||
|
|
||||||
class LogEntry { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 15053466696968532300U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
LogEntry() : category(""), message(""), checksum(0), bucket(0) { |
|
||||||
} |
|
||||||
|
|
||||||
LogEntry(const LogEntry&) = default; |
|
||||||
LogEntry& operator=(const LogEntry&) = default; |
|
||||||
LogEntry(LogEntry&&) = default; |
|
||||||
LogEntry& operator=(LogEntry&&) = default; |
|
||||||
|
|
||||||
void __clear() { |
|
||||||
category = ""; |
|
||||||
message = ""; |
|
||||||
metadata.clear(); |
|
||||||
checksum = 0; |
|
||||||
source.__clear(); |
|
||||||
bucket = 0; |
|
||||||
__isset.__clear(); |
|
||||||
} |
|
||||||
|
|
||||||
virtual ~LogEntry() throw() {} |
|
||||||
|
|
||||||
std::string category; |
|
||||||
std::string message; |
|
||||||
std::map<std::string, std::string> metadata; |
|
||||||
int32_t checksum; |
|
||||||
SourceInfo source; |
|
||||||
int32_t bucket; |
|
||||||
|
|
||||||
struct __isset { |
|
||||||
__isset() { __clear(); } |
|
||||||
void __clear() { |
|
||||||
category = false; |
|
||||||
message = false; |
|
||||||
metadata = false; |
|
||||||
checksum = false; |
|
||||||
source = false; |
|
||||||
bucket = false; |
|
||||||
} |
|
||||||
bool category; |
|
||||||
bool message; |
|
||||||
bool metadata; |
|
||||||
bool checksum; |
|
||||||
bool source; |
|
||||||
bool bucket; |
|
||||||
} __isset; |
|
||||||
|
|
||||||
bool operator == (const LogEntry & rhs) const |
|
||||||
{ |
|
||||||
if (!(this->category == rhs.category)) |
|
||||||
return false; |
|
||||||
if (!(this->message == rhs.message)) |
|
||||||
return false; |
|
||||||
if (__isset.metadata != rhs.__isset.metadata) |
|
||||||
return false; |
|
||||||
else if (__isset.metadata && !(metadata == rhs.metadata)) |
|
||||||
return false; |
|
||||||
if (__isset.checksum != rhs.__isset.checksum) |
|
||||||
return false; |
|
||||||
else if (__isset.checksum && !(checksum == rhs.checksum)) |
|
||||||
return false; |
|
||||||
if (__isset.source != rhs.__isset.source) |
|
||||||
return false; |
|
||||||
else if (__isset.source && !(source == rhs.source)) |
|
||||||
return false; |
|
||||||
if (__isset.bucket != rhs.__isset.bucket) |
|
||||||
return false; |
|
||||||
else if (__isset.bucket && !(bucket == rhs.bucket)) |
|
||||||
return false; |
|
||||||
return true; |
|
||||||
} |
|
||||||
bool operator != (const LogEntry &rhs) const { |
|
||||||
return !(*this == rhs); |
|
||||||
} |
|
||||||
|
|
||||||
bool operator < (const LogEntry & ) const; |
|
||||||
|
|
||||||
uint32_t read(apache::thrift::protocol::TProtocol* iprot); |
|
||||||
uint32_t write(apache::thrift::protocol::TProtocol* oprot) const; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class LogEntry; |
|
||||||
void swap(LogEntry &a, LogEntry &b); |
|
||||||
|
|
||||||
class MessageList { |
|
||||||
public: |
|
||||||
|
|
||||||
static const uint64_t _reflection_id = 5674270912483072844U; |
|
||||||
static void _reflection_register(::apache::thrift::reflection::Schema&); |
|
||||||
MessageList() { |
|
||||||
} |
|
||||||
|
|
||||||
MessageList(const MessageList&) = default; |
|
||||||
MessageList& operator=(const MessageList&) = default; |
|
||||||
MessageList(MessageList&&) = default; |
|
||||||
MessageList& operator=(MessageList&&) = default; |
|
||||||
|
|
||||||
void __clear() { |
|
||||||
messages.clear(); |
|
||||||
__isset.__clear(); |
|
||||||
} |
|
||||||
|
|
||||||
virtual ~MessageList() throw() {} |
|
||||||
|
|
||||||
std::vector<LogEntry> messages; |
|
||||||
|
|
||||||
struct __isset { |
|
||||||
__isset() { __clear(); } |
|
||||||
void __clear() { |
|
||||||
messages = false; |
|
||||||
} |
|
||||||
bool messages; |
|
||||||
} __isset; |
|
||||||
|
|
||||||
bool operator == (const MessageList & rhs) const |
|
||||||
{ |
|
||||||
if (!(this->messages == rhs.messages)) |
|
||||||
return false; |
|
||||||
return true; |
|
||||||
} |
|
||||||
bool operator != (const MessageList &rhs) const { |
|
||||||
return !(*this == rhs); |
|
||||||
} |
|
||||||
|
|
||||||
bool operator < (const MessageList & ) const; |
|
||||||
|
|
||||||
uint32_t read(apache::thrift::protocol::TProtocol* iprot); |
|
||||||
uint32_t write(apache::thrift::protocol::TProtocol* oprot) const; |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
class MessageList; |
|
||||||
void swap(MessageList &a, MessageList &b); |
|
||||||
|
|
||||||
} // namespace
|
|
||||||
|
|
||||||
#endif |
|
@ -1,82 +0,0 @@ |
|||||||
#!/usr/local/bin/thrift --cpp --php |
|
||||||
|
|
||||||
## Copyright (c) 2007-2012 Facebook |
|
||||||
## |
|
||||||
## Licensed under the Apache License, Version 2.0 (the "License"); |
|
||||||
## you may not use this file except in compliance with the License. |
|
||||||
## You may obtain a copy of the License at |
|
||||||
## |
|
||||||
## http://www.apache.org/licenses/LICENSE-2.0 |
|
||||||
## |
|
||||||
## Unless required by applicable law or agreed to in writing, software |
|
||||||
## distributed under the License is distributed on an "AS IS" BASIS, |
|
||||||
## WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
|
||||||
## See the License for the specific language governing permissions and |
|
||||||
## limitations under the License. |
|
||||||
## |
|
||||||
## See accompanying file LICENSE or visit the Scribe site at: |
|
||||||
## http://developers.facebook.com/scribe/ |
|
||||||
|
|
||||||
namespace cpp Tleveldb |
|
||||||
namespace java Tleveldb |
|
||||||
|
|
||||||
// Max message length allowed to log through scribe |
|
||||||
const i32 SCRIBE_MAX_MESSAGE_LENGTH = 26214400; |
|
||||||
|
|
||||||
enum ResultCode |
|
||||||
{ |
|
||||||
OK, |
|
||||||
TRY_LATER, |
|
||||||
ERROR_DECOMPRESS |
|
||||||
} |
|
||||||
|
|
||||||
struct SourceInfo |
|
||||||
{ |
|
||||||
1: binary host, |
|
||||||
2: i32 port, |
|
||||||
3: i64 timestamp |
|
||||||
} |
|
||||||
|
|
||||||
struct LogEntry |
|
||||||
{ |
|
||||||
1: binary category, |
|
||||||
2: binary message, |
|
||||||
3: optional map<string, string> metadata, |
|
||||||
4: optional i32 checksum, |
|
||||||
5: optional SourceInfo source, |
|
||||||
6: optional i32 bucket |
|
||||||
} |
|
||||||
|
|
||||||
struct MessageList |
|
||||||
{ |
|
||||||
1: list<LogEntry> messages |
|
||||||
} |
|
||||||
|
|
||||||
service scribe |
|
||||||
{ |
|
||||||
# |
|
||||||
# Delivers a list of LogEntry messages to the Scribe server. |
|
||||||
# A returned ResultCode of anything other than OK indicates that the |
|
||||||
# whole batch was unable to be delivered to the server. |
|
||||||
# If data loss is a concern, the caller should buffer and retry the messages. |
|
||||||
# |
|
||||||
ResultCode Log(1: list<LogEntry> messages); |
|
||||||
|
|
||||||
# |
|
||||||
# NOTE: FOR INTERNAL USE ONLY! |
|
||||||
# |
|
||||||
# Delivers a list of LogEntry messages to the Scribe server, but |
|
||||||
# allows partial successes. A list of ResultCodes will be returned to |
|
||||||
# indicate the success or failure of each message at the corresponding index. |
|
||||||
# If data loss is a concern, the caller should retry only the failed messages. |
|
||||||
# |
|
||||||
list<ResultCode> LogMulti(1: list<LogEntry> messages); |
|
||||||
|
|
||||||
# |
|
||||||
# NOTE: FOR INTERNAL USE ONLY! |
|
||||||
# |
|
||||||
# The same as Log(...) except that the list of messages must first be |
|
||||||
# serialized and compressed in some internal format. |
|
||||||
# |
|
||||||
ResultCode LogCompressedMsg(1: binary compressedMessages); |
|
||||||
} |
|
@ -1,82 +0,0 @@ |
|||||||
#include "scribe_logger.h" |
|
||||||
|
|
||||||
namespace rocksdb { |
|
||||||
|
|
||||||
const std::string ScribeLogger::COL_SEPERATOR = "\x1"; |
|
||||||
const std::string ScribeLogger::DEPLOY_STATS_CATEGORY = "leveldb_deploy_stats"; |
|
||||||
|
|
||||||
ScribeLogger::ScribeLogger(const std::string& host, int port, |
|
||||||
int retry_times, uint32_t retry_intervals) |
|
||||||
: host_(host), |
|
||||||
port_(port), |
|
||||||
retry_times_(retry_times), |
|
||||||
retry_intervals_ (retry_intervals) { |
|
||||||
shared_ptr<TSocket> socket(new TSocket(host_, port_)); |
|
||||||
shared_ptr<TFramedTransport> framedTransport(new TFramedTransport(socket)); |
|
||||||
framedTransport->open(); |
|
||||||
shared_ptr<TBinaryProtocol> protocol(new TBinaryProtocol(framedTransport)); |
|
||||||
scribe_client_ = new scribeClient(protocol); |
|
||||||
} |
|
||||||
|
|
||||||
void ScribeLogger::Log(const std::string& category, |
|
||||||
const std::string& message) { |
|
||||||
LogEntry entry; |
|
||||||
entry.category = category; |
|
||||||
entry.message = message; |
|
||||||
|
|
||||||
std::vector<LogEntry> logs; |
|
||||||
logs.push_back(entry); |
|
||||||
|
|
||||||
logger_mutex_.Lock(); |
|
||||||
ResultCode ret = scribe_client_->Log(logs); |
|
||||||
int retries_left = retry_times_; |
|
||||||
while (ret == TRY_LATER && retries_left > 0) { |
|
||||||
Env::Default()->SleepForMicroseconds(retry_intervals_); |
|
||||||
ret = scribe_client_->Log(logs); |
|
||||||
retries_left--; |
|
||||||
} |
|
||||||
|
|
||||||
logger_mutex_.Unlock(); |
|
||||||
} |
|
||||||
|
|
||||||
void ScribeLogger::MakeScribeMessage(std::string& output, |
|
||||||
std::vector<std::string>& cols) { |
|
||||||
int sz = cols.size(); |
|
||||||
int i = 0; |
|
||||||
for (; i < sz - 1; i++) { |
|
||||||
std::string& col = cols.at(i); |
|
||||||
output += col; |
|
||||||
output += ScribeLogger::COL_SEPERATOR; |
|
||||||
} |
|
||||||
std::string& col = cols.at(i); |
|
||||||
output+=col; |
|
||||||
} |
|
||||||
|
|
||||||
void ScribeLogger::Log_Deploy_Stats( |
|
||||||
const std::string& db_version, |
|
||||||
const std::string& machine_info, |
|
||||||
const std::string& data_dir, |
|
||||||
const uint64_t data_size, |
|
||||||
const uint32_t file_number, |
|
||||||
const std::string& data_size_per_level, |
|
||||||
const std::string& file_number_per_level, |
|
||||||
const int64_t& ts_unix) { |
|
||||||
std::string message; |
|
||||||
std::vector<std::string> cols; |
|
||||||
cols.push_back(db_version); |
|
||||||
cols.push_back(machine_info); |
|
||||||
cols.push_back(data_dir); |
|
||||||
cols.push_back(boost::lexical_cast<std::string>(data_size)); |
|
||||||
cols.push_back(boost::lexical_cast<std::string>(file_number)); |
|
||||||
cols.push_back(data_size_per_level); |
|
||||||
cols.push_back(file_number_per_level); |
|
||||||
cols.push_back(boost::lexical_cast<std::string>(ts_unix)); |
|
||||||
MakeScribeMessage(message, cols); |
|
||||||
return Log(ScribeLogger::DEPLOY_STATS_CATEGORY, message); |
|
||||||
} |
|
||||||
|
|
||||||
ScribeLogger::~ScribeLogger(){ |
|
||||||
delete scribe_client_; |
|
||||||
} |
|
||||||
|
|
||||||
} |
|
@ -1,69 +0,0 @@ |
|||||||
#ifndef SCRIBE_LOGGER_H_ |
|
||||||
#define SCRIBE_LOGGER_H_ |
|
||||||
|
|
||||||
#include "scribe/if/gen-cpp/scribe.h" |
|
||||||
#include "scribe/if/gen-cpp/scribe_types.h" |
|
||||||
#include "thrift/lib/cpp/protocol/TProtocol.h" |
|
||||||
#include "thrift/lib/cpp/transport/TSocket.h" |
|
||||||
#include "thrift/lib/cpp/protocol/TBinaryProtocol.h" |
|
||||||
#include "thrift/lib/cpp/transport/TBufferTransports.h" |
|
||||||
|
|
||||||
#include "leveldb/env.h" |
|
||||||
#include "port/port.h" |
|
||||||
#include "util/stats_logger.h" |
|
||||||
|
|
||||||
#include "boost/lexical_cast.hpp" |
|
||||||
|
|
||||||
using namespace Tleveldb; |
|
||||||
using Trocksdb::scribeClient; |
|
||||||
|
|
||||||
using namespace apache::thrift; |
|
||||||
using namespace apache::thrift::protocol; |
|
||||||
using namespace apache::thrift::transport; |
|
||||||
using boost::shared_ptr; |
|
||||||
|
|
||||||
|
|
||||||
using namespace ::Tleveldb; |
|
||||||
|
|
||||||
namespace rocksdb { |
|
||||||
|
|
||||||
class ScribeLogger : public StatsLogger{ |
|
||||||
private: |
|
||||||
std::string host_; |
|
||||||
int port_; |
|
||||||
int batch_size_; |
|
||||||
|
|
||||||
scribeClient* scribe_client_; |
|
||||||
port::Mutex logger_mutex_; |
|
||||||
|
|
||||||
int retry_times_; |
|
||||||
uint32_t retry_intervals_; |
|
||||||
|
|
||||||
void MakeScribeMessage(std::string& output, std::vector<std::string>& cols); |
|
||||||
|
|
||||||
public: |
|
||||||
|
|
||||||
static const std::string COL_SEPERATOR; |
|
||||||
static const std::string DEPLOY_STATS_CATEGORY; |
|
||||||
|
|
||||||
ScribeLogger(const std::string& host, int port, |
|
||||||
int retry_times=3, uint32_t retry_intervals=1000000); |
|
||||||
virtual ~ScribeLogger(); |
|
||||||
|
|
||||||
virtual void Log(const std::string& category, const std::string& message); |
|
||||||
|
|
||||||
virtual void Log_Deploy_Stats( |
|
||||||
const std::string& db_version, |
|
||||||
const std::string& machine_info, |
|
||||||
const std::string& data_dir, |
|
||||||
const uint64_t data_size, |
|
||||||
const uint32_t file_number, |
|
||||||
const std::string& data_size_per_level, |
|
||||||
const std::string& file_number_per_level, |
|
||||||
const int64_t& ts_unix |
|
||||||
); |
|
||||||
|
|
||||||
}; |
|
||||||
} |
|
||||||
|
|
||||||
#endif /* SCRIBE_LOGGER_H_ */ |
|
@ -1,25 +0,0 @@ |
|||||||
This directory has the thrift server code that exposes leveldb apis. |
|
||||||
|
|
||||||
The thrift api is specified in thrift/if/leveldb.thrift. |
|
||||||
|
|
||||||
The thrift header files are in ./thrift/lib. These are part of |
|
||||||
Apache Thrift code base and are needed for compilation of the leveldb |
|
||||||
thrift server. The thrift libraries are copied into ./thrift/libs. |
|
||||||
If you want to use a different version of thrift, please update these |
|
||||||
directories with the corresponding thrift header files and the |
|
||||||
compiled thrift libraries. |
|
||||||
|
|
||||||
If you want to compile leveldb with thrift-server support, please set the following |
|
||||||
enviroment variables appropriately: |
|
||||||
USE_THRIFT=1 |
|
||||||
LD_LIBRARY_PATH=$LD_LIBRARY_PATH:./thrift/libs:./snappy/libs |
|
||||||
make clean leveldb_server leveldb_server_test |
|
||||||
|
|
||||||
You can run the leveldb server unit tests by |
|
||||||
./leveldb_server_test |
|
||||||
|
|
||||||
You can regenerate the thrift cpp files by doing the following |
|
||||||
|
|
||||||
cd ./thrift |
|
||||||
bin/thrift --gen cpp if/leveldb.thrift |
|
||||||
|
|
@ -1,806 +0,0 @@ |
|||||||
/**
|
|
||||||
* Thrift server that supports operations on the
|
|
||||||
* Facebook TAO Graph database |
|
||||||
* @author Dhruba Borthakur (dhruba@gmail.com) |
|
||||||
* Copyright 2012 Facebook |
|
||||||
*/ |
|
||||||
#ifndef THRIFT_LEVELDB_ASSOC_SERVER_H_ |
|
||||||
#define THRIFT_LEVELDB_ASSOC_SERVER_H_ |
|
||||||
|
|
||||||
#include <AssocService.h> |
|
||||||
#include <leveldb_types.h> |
|
||||||
#include "openhandles.h" |
|
||||||
#include "server_options.h" |
|
||||||
|
|
||||||
#include "leveldb/db.h" |
|
||||||
#include "leveldb/write_batch.h" |
|
||||||
#include "util/testharness.h" |
|
||||||
#include "port/port.h" |
|
||||||
#include "util/mutexlock.h" |
|
||||||
#include "util/murmurhash.h" |
|
||||||
|
|
||||||
using namespace apache::thrift; |
|
||||||
using namespace apache::thrift::protocol; |
|
||||||
using namespace apache::thrift::transport; |
|
||||||
using namespace apache::thrift::server; |
|
||||||
|
|
||||||
using boost::shared_ptr; |
|
||||||
|
|
||||||
using namespace ::Tleveldb; |
|
||||||
|
|
||||||
//
|
|
||||||
// These are the service methods that processes Association Data.
|
|
||||||
// Native types are stored in big-endian format, i.e. first bytes
|
|
||||||
// have most significant bits.
|
|
||||||
|
|
||||||
class AssocServiceHandler : virtual public AssocServiceIf { |
|
||||||
public: |
|
||||||
|
|
||||||
AssocServiceHandler(OpenHandles* openhandles) { |
|
||||||
openhandles_ = openhandles; |
|
||||||
woptions_sync_.sync = true; |
|
||||||
} |
|
||||||
|
|
||||||
int64_t taoAssocPut(const Text& tableName, int64_t assocType, int64_t id1,
|
|
||||||
int64_t id2, int64_t id1Type, int64_t id2Type,
|
|
||||||
int64_t timestamp, AssocVisibility visibility,
|
|
||||||
bool update_count, int64_t dataVersion, const Text& data,
|
|
||||||
const Text& wormhole_comment) { |
|
||||||
rocksdb::DB* db = openhandles_->get(tableName, NULL); |
|
||||||
if (db == NULL) { |
|
||||||
return Code::kNotFound; |
|
||||||
} |
|
||||||
int64_t ret = assocPutInternal(tableName, |
|
||||||
db, assocType, id1, id2, id1Type, id2Type, |
|
||||||
timestamp, visibility, update_count, dataVersion, |
|
||||||
data, wormhole_comment); |
|
||||||
return ret; |
|
||||||
} |
|
||||||
|
|
||||||
int64_t taoAssocDelete(const Text& tableName, int64_t assocType, int64_t id1,
|
|
||||||
int64_t id2, AssocVisibility visibility, bool update_count,
|
|
||||||
const Text& wormhole_comment) { |
|
||||||
rocksdb::DB* db = openhandles_->get(tableName, NULL); |
|
||||||
if (db == NULL) { |
|
||||||
return Code::kNotFound; |
|
||||||
} |
|
||||||
return assocDeleteInternal(tableName, db, assocType, id1, id2, visibility, |
|
||||||
update_count, wormhole_comment); |
|
||||||
return 0; |
|
||||||
} |
|
||||||
|
|
||||||
void taoAssocRangeGet(std::vector<TaoAssocGetResult> & _return,
|
|
||||||
const Text& tableName, int64_t assocType, int64_t id1,
|
|
||||||
int64_t start_time, int64_t end_time, int64_t offset,
|
|
||||||
int64_t limit) { |
|
||||||
rocksdb::DB* db = openhandles_->get(tableName, NULL); |
|
||||||
if (db == NULL) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"taoAssocRangeGet: Unable to open database " , |
|
||||||
assocType, id1, 0, 0, 0, 0, Trocksdb::UNUSED1); |
|
||||||
} |
|
||||||
assocRangeGetBytimeInternal(_return, tableName, db, assocType, id1, |
|
||||||
start_time, end_time, offset, limit); |
|
||||||
} |
|
||||||
|
|
||||||
void taoAssocGet(std::vector<TaoAssocGetResult> & _return,
|
|
||||||
const Text& tableName, int64_t assocType, int64_t id1,
|
|
||||||
const std::vector<int64_t> & id2s) { |
|
||||||
rocksdb::DB* db = openhandles_->get(tableName, NULL); |
|
||||||
if (db == NULL) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"taoAssocGet:Unable to open database " , |
|
||||||
assocType, id1, 0, 0, 0, 0, Trocksdb::UNUSED1); |
|
||||||
} |
|
||||||
assocGetInternal(_return, tableName, db, assocType, id1, id2s); |
|
||||||
} |
|
||||||
|
|
||||||
int64_t taoAssocCount(const Text& tableName, int64_t assocType, int64_t id1) { |
|
||||||
rocksdb::DB* db = openhandles_->get(tableName, NULL); |
|
||||||
if (db == NULL) { |
|
||||||
return Code::kNotFound; |
|
||||||
} |
|
||||||
return assocCountInternal(tableName, db, assocType, id1); |
|
||||||
} |
|
||||||
|
|
||||||
private: |
|
||||||
OpenHandles* openhandles_; |
|
||||||
rocksdb::ReadOptions roptions_; |
|
||||||
rocksdb::WriteOptions woptions_; // write with no sync
|
|
||||||
rocksdb::WriteOptions woptions_sync_; // write with sync
|
|
||||||
|
|
||||||
// the maximum values returned in a rangeget/multiget call.
|
|
||||||
const static unsigned int MAX_RANGE_SIZE = 10000; |
|
||||||
|
|
||||||
// the seed for murmur hash (copied from Hadoop)
|
|
||||||
const static unsigned int HASHSEED = 0x5bd1e995; |
|
||||||
|
|
||||||
// A bunch of rowlocks, sharded over the entire rowkey range
|
|
||||||
// Each rowkey is deterministically mapped to one of these locks.
|
|
||||||
rocksdb::port::RWMutex rowlocks_[1000]; |
|
||||||
|
|
||||||
// A helper method that hashes the row key to a lock
|
|
||||||
rocksdb::port::RWMutex* findRowLock(char* str, int size) { |
|
||||||
int index = MurmurHash(str, size, HASHSEED) % sizeof(rowlocks_); |
|
||||||
return &rowlocks_[index]; |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Inserts an assoc
|
|
||||||
// If update_count, returns the updated count of the assoc.
|
|
||||||
// If !update_count, return zero.
|
|
||||||
// On failure, throws exception
|
|
||||||
//
|
|
||||||
int64_t assocPutInternal(const Text& tableName, rocksdb::DB* db, |
|
||||||
int64_t assocType, int64_t id1,
|
|
||||||
int64_t id2, int64_t id1Type, int64_t id2Type,
|
|
||||||
int64_t ts, AssocVisibility vis,
|
|
||||||
bool update_count, int64_t dataVersion, const Text& data,
|
|
||||||
const Text& wormhole_comment) { |
|
||||||
rocksdb::WriteBatch batch; |
|
||||||
ts = convertTime(ts); // change time to numberofmillis till MAXLONG
|
|
||||||
|
|
||||||
// create the payload for this assoc
|
|
||||||
int payloadsize = sizeof(id1Type) + sizeof(id2Type) + sizeof(dataVersion) + |
|
||||||
sizeof(int32_t) + // store the data size
|
|
||||||
sizeof(int32_t) + // store the wormhole comment size
|
|
||||||
data.size() + wormhole_comment.size(); |
|
||||||
std::string payload; |
|
||||||
payload.reserve(payloadsize); |
|
||||||
payload.resize(payloadsize); |
|
||||||
makePayload(&payload[0], id1Type, id2Type, dataVersion, data,
|
|
||||||
wormhole_comment); |
|
||||||
|
|
||||||
int64_t count = 0; |
|
||||||
int64_t oldts; |
|
||||||
int8_t oldvis; |
|
||||||
bool newassoc = false; // is this assoc new or an overwrite
|
|
||||||
rocksdb::Status status; |
|
||||||
std::string value; |
|
||||||
|
|
||||||
// create RowKey for 'c'
|
|
||||||
int maxkeysize = sizeof(id1) + sizeof(assocType) + 1; |
|
||||||
std::string dummy1; |
|
||||||
dummy1.reserve(maxkeysize); |
|
||||||
dummy1.resize(maxkeysize); |
|
||||||
char* keybuf = &dummy1[0]; |
|
||||||
int rowkeysize = makeRowKey(keybuf, id1, assocType); |
|
||||||
int keysize = appendRowKeyForCount(rowkeysize, keybuf); |
|
||||||
rocksdb::Slice ckey(keybuf, keysize); |
|
||||||
|
|
||||||
// find the row lock
|
|
||||||
rocksdb::port::RWMutex* rowlock = findRowLock(keybuf, rowkeysize); |
|
||||||
{ |
|
||||||
// acquire the row lock
|
|
||||||
rocksdb::WriteLock l(rowlock); |
|
||||||
|
|
||||||
// Scan 'c' to get $count if $update_count == true
|
|
||||||
if (update_count) { |
|
||||||
status = db->Get(roptions_, ckey, &value); |
|
||||||
if (status.IsNotFound()) { |
|
||||||
// nothing to do
|
|
||||||
} else if (!status.ok() || (value.size() != sizeof(int64_t))) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"AssocPut Unable to extract count ",
|
|
||||||
assocType, id1, id2, id1Type, id2Type, ts, vis); |
|
||||||
} else { |
|
||||||
extract_int64(&count, (char *)value.c_str()); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
// Scan 'm'$id2 to get $ts and $vis
|
|
||||||
maxkeysize = sizeof(id1) + sizeof(assocType) + 1 + sizeof(id2); |
|
||||||
std::string dummy2; |
|
||||||
dummy2.reserve(maxkeysize); |
|
||||||
dummy2.resize(maxkeysize); |
|
||||||
keybuf = &dummy2[0]; |
|
||||||
rowkeysize = makeRowKey(keybuf, id1, assocType); |
|
||||||
keysize = appendRowKeyForMeta(rowkeysize, keybuf, id2); |
|
||||||
rocksdb::Slice mkey(keybuf, keysize); |
|
||||||
status = db->Get(roptions_, mkey, &value); |
|
||||||
if (status.IsNotFound()) { |
|
||||||
newassoc = true; |
|
||||||
oldvis = UNUSED1; |
|
||||||
} else if (!status.ok() ||
|
|
||||||
(value.size() != sizeof(int64_t) + sizeof(int8_t))) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"AssocPut Unable to extract m$id2 ",
|
|
||||||
assocType, id1, id2, id1Type, id2Type, ts, vis); |
|
||||||
} |
|
||||||
|
|
||||||
// make the key 'p'$old_ts$id2
|
|
||||||
maxkeysize = sizeof(id1) + sizeof(assocType) + 1 + |
|
||||||
sizeof(ts) + sizeof(id2); |
|
||||||
std::string dummy3; |
|
||||||
dummy3.reserve(maxkeysize); |
|
||||||
dummy3.resize(maxkeysize); |
|
||||||
keybuf = &dummy3[0]; |
|
||||||
rowkeysize = makeRowKey(keybuf, id1, assocType); |
|
||||||
|
|
||||||
// if ts != oldts, then delete 'p'$old_ts$id2
|
|
||||||
if (!newassoc) { |
|
||||||
extractTsVisString(&oldts, &oldvis, (char *)value.c_str()); |
|
||||||
keysize = appendRowKeyForPayload(rowkeysize, keybuf, oldts, id2); |
|
||||||
rocksdb::Slice pkey(keybuf, keysize); |
|
||||||
if (ts != oldts) { |
|
||||||
batch.Delete(pkey); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
// store in m$id2 the value of $ts$vis
|
|
||||||
std::string myvalue; |
|
||||||
myvalue.reserve(sizeof(int64_t) + sizeof(int8_t)); |
|
||||||
myvalue.resize(sizeof(int64_t) + sizeof(int8_t)); |
|
||||||
makeTsVisString(&myvalue[0], ts, vis); |
|
||||||
rocksdb::Slice sl(myvalue); |
|
||||||
batch.Put(mkey, rocksdb::Slice(myvalue)); |
|
||||||
|
|
||||||
// store in p$ts$id2 the payload
|
|
||||||
keybuf = &dummy3[0]; |
|
||||||
keysize = appendRowKeyForPayload(rowkeysize, keybuf, ts, id2); |
|
||||||
rocksdb::Slice pkeynew(keybuf, keysize); |
|
||||||
batch.Put(pkeynew, rocksdb::Slice(payload)); |
|
||||||
|
|
||||||
// increment count
|
|
||||||
if (update_count && (newassoc || oldvis != VISIBLE)) { |
|
||||||
assert(count >= 0); |
|
||||||
count++; |
|
||||||
myvalue.reserve(sizeof(int64_t)); |
|
||||||
myvalue.resize(sizeof(int64_t)); |
|
||||||
makeCountString(&myvalue[0], count); |
|
||||||
batch.Put(ckey, rocksdb::Slice(myvalue)); |
|
||||||
} |
|
||||||
|
|
||||||
// We do a write here without sync. This writes it to the
|
|
||||||
// transaction log but does not sync it. It also makes these
|
|
||||||
// changes readable by other threads.
|
|
||||||
status = db->Write(woptions_, &batch); |
|
||||||
if (!status.ok()) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"AssocPut Unable to batch write ",
|
|
||||||
assocType, id1, id2, id1Type, id2Type, ts, vis); |
|
||||||
} |
|
||||||
} // release rowlock
|
|
||||||
|
|
||||||
// Do a sync to the transaction log without holding the rowlock.
|
|
||||||
// This improves updates for hotrows. The disadvantage is that
|
|
||||||
// uncommiitted reads might be read by other threads, but that
|
|
||||||
// should be ok.
|
|
||||||
batch.Clear(); |
|
||||||
status = db->Write(woptions_sync_, &batch); |
|
||||||
if (!status.ok()) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"AssocPut Unable to batch sync write ",
|
|
||||||
assocType, id1, id2, id1Type, id2Type, ts, vis); |
|
||||||
} |
|
||||||
if (update_count) { |
|
||||||
assert(count > 0); |
|
||||||
return count; |
|
||||||
} |
|
||||||
return 0; |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Deletes an assoc
|
|
||||||
// If count changes return 1, else returns zero
|
|
||||||
// On failure, thrws exception
|
|
||||||
//
|
|
||||||
int64_t assocDeleteInternal(const Text& tableName, rocksdb::DB* db, |
|
||||||
int64_t assocType, int64_t id1,
|
|
||||||
int64_t id2, AssocVisibility vis,
|
|
||||||
bool update_count, const Text& wormhole_comment) { |
|
||||||
rocksdb::WriteBatch batch; |
|
||||||
int return_value = 0; |
|
||||||
int64_t count = 0; |
|
||||||
int64_t oldts; |
|
||||||
int8_t oldvis; |
|
||||||
std::string value; |
|
||||||
|
|
||||||
// make a key for count
|
|
||||||
int maxkeysize = sizeof(id1) + sizeof(assocType) + 1; |
|
||||||
std::string dummy; |
|
||||||
dummy.reserve(maxkeysize); |
|
||||||
dummy.resize(maxkeysize); |
|
||||||
char* keybuf = &dummy[0]; |
|
||||||
int rowkeysize = makeRowKey(keybuf, id1, assocType); |
|
||||||
rocksdb::Status status; |
|
||||||
int keysize = appendRowKeyForCount(rowkeysize, keybuf); |
|
||||||
rocksdb::Slice ckey(keybuf, keysize); |
|
||||||
|
|
||||||
// find the row lock
|
|
||||||
rocksdb::port::RWMutex* rowlock = findRowLock(keybuf, rowkeysize); |
|
||||||
{ |
|
||||||
// acquire the row lock
|
|
||||||
rocksdb::WriteLock l(rowlock); |
|
||||||
|
|
||||||
// Scan 'c' to get $count if $update_count == true
|
|
||||||
if (update_count) { |
|
||||||
status = db->Get(roptions_, ckey, &value); |
|
||||||
if (status.IsNotFound()) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"assocDelete: Unable to find count ",
|
|
||||||
assocType, id1, id2, 0, 0, 0, vis); |
|
||||||
} else if (!status.ok() || (value.size() != sizeof(int64_t))) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"assocDelete: Unable to extract count ",
|
|
||||||
assocType, id1, id2, 0, 0, 0, vis); |
|
||||||
} else { |
|
||||||
extract_int64(&count, (char *)value.c_str()); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
// Scan 'm'$id2 to get $ts and $vis
|
|
||||||
maxkeysize = sizeof(id1) + sizeof(assocType) + 1 + sizeof(id2); |
|
||||||
std::string dummy2; |
|
||||||
dummy2.reserve(maxkeysize); |
|
||||||
dummy2.resize(maxkeysize); |
|
||||||
keybuf = &dummy2[0]; |
|
||||||
rowkeysize = makeRowKey(keybuf, id1, assocType); |
|
||||||
keysize = appendRowKeyForMeta(rowkeysize, keybuf, id2); |
|
||||||
rocksdb::Slice mkey(keybuf, keysize); |
|
||||||
status = db->Get(roptions_, mkey, &value); |
|
||||||
if (status.IsNotFound()) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"assocDelete Unable to find column m ",
|
|
||||||
assocType, id1, id2, 0, 0, 0, vis); |
|
||||||
} else if (!status.ok() || |
|
||||||
(value.size() != sizeof(int64_t) + sizeof(int8_t))) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"assocDelete Unable to extract m$id2 ", |
|
||||||
assocType, id1, id2, 0, 0, 0, vis); |
|
||||||
} |
|
||||||
extractTsVisString(&oldts, &oldvis, (char *)value.c_str()); |
|
||||||
|
|
||||||
// Create d'$id2
|
|
||||||
maxkeysize = sizeof(id1) + sizeof(assocType) + 1 + sizeof(id2); |
|
||||||
std::string dummy3; |
|
||||||
dummy3.reserve(maxkeysize); |
|
||||||
dummy3.resize(maxkeysize); |
|
||||||
keybuf = &dummy3[0]; |
|
||||||
rowkeysize = makeRowKey(keybuf, id1, assocType); |
|
||||||
keysize = appendRowKeyForDelete(rowkeysize, keybuf, id2); |
|
||||||
rocksdb::Slice dkey(keybuf, keysize); |
|
||||||
|
|
||||||
// create key for 'p'
|
|
||||||
maxkeysize = sizeof(id1) + sizeof(assocType) + 1 + |
|
||||||
sizeof(oldts) + sizeof(id2); |
|
||||||
std::string dummy4; |
|
||||||
dummy4.reserve(maxkeysize); |
|
||||||
dummy4.resize(maxkeysize); |
|
||||||
keybuf = &dummy4[0]; |
|
||||||
rowkeysize = makeRowKey(keybuf, id1, assocType); |
|
||||||
keysize = appendRowKeyForPayload(rowkeysize, keybuf, oldts, id2); |
|
||||||
rocksdb::Slice pkey(keybuf, keysize); |
|
||||||
|
|
||||||
// if this is a hard delete, then delete all columns
|
|
||||||
if (vis == AssocVisibility::HARD_DELETE) { |
|
||||||
batch.Delete(ckey); |
|
||||||
batch.Delete(mkey); |
|
||||||
batch.Delete(dkey); |
|
||||||
batch.Delete(pkey); |
|
||||||
} else if (vis == AssocVisibility::DELETED) { |
|
||||||
if (oldvis != AssocVisibility::DELETED) { |
|
||||||
// change vis in m$id2
|
|
||||||
std::string mvalue; |
|
||||||
mvalue.reserve(sizeof(int64_t) + sizeof(int8_t)); |
|
||||||
mvalue.resize(sizeof(int64_t) + sizeof(int8_t)); |
|
||||||
makeTsVisString(&mvalue[0], oldts, vis); |
|
||||||
batch.Put(mkey, rocksdb::Slice(mvalue)); |
|
||||||
} |
|
||||||
|
|
||||||
// scan p$tsid2 to get payload
|
|
||||||
// do we need to modify payload with new wormhole comments?
|
|
||||||
std::string pvalue; |
|
||||||
status = db->Get(roptions_, pkey, &pvalue); |
|
||||||
if (status.IsNotFound()) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"assocDelete Unable to find p ", |
|
||||||
assocType, id1, id2, 0, 0, oldts, vis); |
|
||||||
} else if (!status.ok() || |
|
||||||
(value.size() != sizeof(int64_t) + sizeof(int8_t))) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"assocDelete Unable to extract p ", |
|
||||||
assocType, id1, id2, 0, 0, oldts, vis); |
|
||||||
} |
|
||||||
|
|
||||||
// store payload in d$id2
|
|
||||||
batch.Put(dkey, rocksdb::Slice(pvalue)); |
|
||||||
|
|
||||||
// delete p$ts$id2
|
|
||||||
batch.Delete(pkey); |
|
||||||
} |
|
||||||
if (update_count && oldvis == AssocVisibility::VISIBLE) { |
|
||||||
return_value = 1; |
|
||||||
assert(count >= 1); |
|
||||||
count--; |
|
||||||
std::string myvalue; |
|
||||||
myvalue.reserve(sizeof(int64_t)); |
|
||||||
myvalue.resize(sizeof(int64_t)); |
|
||||||
makeCountString(&myvalue[0], count); |
|
||||||
batch.Put(ckey, rocksdb::Slice(myvalue)); |
|
||||||
} |
|
||||||
status = db->Write(woptions_, &batch); // write with no sync
|
|
||||||
if (!status.ok()) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"assocDelete Unable to Batch Write ", |
|
||||||
assocType, id1, id2, 0, 0, oldts, vis); |
|
||||||
} |
|
||||||
} // release rowlock
|
|
||||||
|
|
||||||
// Do a sync write after releasing the rowlock. This
|
|
||||||
// improves performance for hotrow updates.
|
|
||||||
batch.Clear(); |
|
||||||
status = db->Write(woptions_sync_, &batch); |
|
||||||
if (!status.ok()) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"assocDelete Unable to Batch sync Write ", |
|
||||||
assocType, id1, id2, 0, 0, oldts, vis); |
|
||||||
} |
|
||||||
if (update_count) { |
|
||||||
assert(count >= 0); |
|
||||||
return count; |
|
||||||
} |
|
||||||
return return_value; |
|
||||||
} |
|
||||||
|
|
||||||
int64_t assocCountInternal(const Text& tableName, rocksdb::DB* db, |
|
||||||
int64_t assocType, int64_t id1) { |
|
||||||
// create key to query
|
|
||||||
int maxkeysize = sizeof(id1) + sizeof(assocType) + 1; |
|
||||||
std::string dummy; |
|
||||||
dummy.reserve(maxkeysize); |
|
||||||
dummy.resize(maxkeysize); |
|
||||||
char* keybuf = &dummy[0]; |
|
||||||
int rowkeysize = makeRowKey(keybuf, id1, assocType); |
|
||||||
int keysize = appendRowKeyForCount(rowkeysize, keybuf); // column 'c'
|
|
||||||
rocksdb::Slice ckey(keybuf, keysize); |
|
||||||
|
|
||||||
// Query database to find value
|
|
||||||
rocksdb::Status status; |
|
||||||
std::string value; |
|
||||||
int64_t count; |
|
||||||
status = db->Get(roptions_, ckey, &value); |
|
||||||
|
|
||||||
// parse results retrieved from database
|
|
||||||
if (status.IsNotFound()) { |
|
||||||
return 0; // non existant assoc
|
|
||||||
} else if (!status.ok()) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"assocCountInternal Unable to find count ", |
|
||||||
assocType, id1, 0, 0, 0, 0, Trocksdb::UNUSED1); |
|
||||||
} |
|
||||||
if (value.size() != sizeof(int64_t)) { |
|
||||||
printf("expected %ld got %ld\n", sizeof(int64_t), value.size()); |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"assocCountInternal Bad sizes for count ", |
|
||||||
assocType, id1, 0, 0, 0, 0, Trocksdb::UNUSED1); |
|
||||||
} |
|
||||||
extract_int64(&count, (char *)value.c_str()); |
|
||||||
return count; |
|
||||||
} |
|
||||||
|
|
||||||
void assocRangeGetBytimeInternal(std::vector<TaoAssocGetResult> & _return,
|
|
||||||
const Text& tableName, rocksdb::DB* db, |
|
||||||
int64_t assocType, int64_t id1,
|
|
||||||
int64_t start_time, int64_t end_time, int64_t offset,
|
|
||||||
int64_t limit) { |
|
||||||
if (start_time < end_time) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"assocRangeGetBytimeInternal:Bad starttime and endtime\n", |
|
||||||
assocType, id1, 0, 0, 0, 0, Trocksdb::UNUSED1); |
|
||||||
} |
|
||||||
|
|
||||||
int64_t ts, id2; |
|
||||||
std::string wormhole; |
|
||||||
|
|
||||||
// convert times to time-till-LONGMAX
|
|
||||||
int64_t startTime = convertTime(start_time); |
|
||||||
int64_t endTime = convertTime(end_time); |
|
||||||
|
|
||||||
// create max key to query
|
|
||||||
int maxkeysize = sizeof(id1) + sizeof(assocType) + 1 + sizeof(ts) + |
|
||||||
sizeof(id2); |
|
||||||
std::string dummy; |
|
||||||
dummy.reserve(maxkeysize); |
|
||||||
dummy.resize(maxkeysize); |
|
||||||
|
|
||||||
// create rowkey
|
|
||||||
char* keybuf = &dummy[0]; |
|
||||||
int rowkeysize = makeRowKey(keybuf, id1, assocType); |
|
||||||
|
|
||||||
// Position scan at 'p'$ts$id2 where ts = startTime and id2 = 0
|
|
||||||
id2 = 0; |
|
||||||
int keysize = appendRowKeyForPayload(rowkeysize, keybuf, startTime, id2);
|
|
||||||
rocksdb::Slice pkey(keybuf, keysize); |
|
||||||
rocksdb::Iterator* iter = db->NewIterator(roptions_); |
|
||||||
|
|
||||||
for (iter->Seek(pkey); iter->Valid() && limit > 0 ; iter->Next()) { |
|
||||||
// skip over records that the caller is not interested in
|
|
||||||
if (offset > 0) { |
|
||||||
offset--; |
|
||||||
continue; |
|
||||||
} |
|
||||||
ASSERT_GE(iter->key().size_, (unsigned int)rowkeysize); |
|
||||||
|
|
||||||
// extract the timestamp and id1 from the key
|
|
||||||
extractRowKeyP(&ts, &id2, rowkeysize, (char*)(iter->key().data_)); |
|
||||||
ASSERT_GE(ts, startTime); |
|
||||||
if (ts > endTime) { |
|
||||||
break; |
|
||||||
} |
|
||||||
|
|
||||||
// allocate a new slot in the result set.
|
|
||||||
_return.resize(_return.size() + 1); |
|
||||||
TaoAssocGetResult* result = &_return.back(); |
|
||||||
|
|
||||||
// Fill up new element in result set.
|
|
||||||
result->id2 = id2; |
|
||||||
result->time = convertTime(ts); |
|
||||||
extractPayload((char*)iter->value().data_, &result->id1Type, |
|
||||||
&result->id2Type, |
|
||||||
&result->dataVersion, result->data, wormhole); |
|
||||||
limit--; |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
void assocGetInternal(std::vector<TaoAssocGetResult> & _return,
|
|
||||||
const Text& tableName,
|
|
||||||
rocksdb::DB* db, |
|
||||||
int64_t assocType, int64_t id1,
|
|
||||||
const std::vector<int64_t> & id2s) { |
|
||||||
int64_t ts, id2; |
|
||||||
|
|
||||||
if (id2s.size() > MAX_RANGE_SIZE) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"assocGetInternal Ids2 cannot be gteater than 10K.", |
|
||||||
assocType, id1, 0, 0, 0, 0, Trocksdb::UNUSED1); |
|
||||||
} |
|
||||||
// allocate the entire result buffer.
|
|
||||||
_return.reserve(id2s.size()); |
|
||||||
|
|
||||||
// create max key to query
|
|
||||||
int maxkeysize = sizeof(id1) + sizeof(assocType) + 1 + sizeof(ts) + |
|
||||||
sizeof(id2); |
|
||||||
std::string dummy; |
|
||||||
dummy.reserve(maxkeysize); |
|
||||||
dummy.resize(maxkeysize); |
|
||||||
|
|
||||||
// create rowkey
|
|
||||||
char* keybuf = &dummy[0]; |
|
||||||
int rowkeysize = makeRowKey(keybuf, id1, assocType); |
|
||||||
rocksdb::Iterator* iter = db->NewIterator(roptions_); |
|
||||||
|
|
||||||
for (unsigned int index = 0; index < id2s.size(); index++) { |
|
||||||
int64_t ts; |
|
||||||
int8_t oldvis; |
|
||||||
rocksdb::Status status; |
|
||||||
std::string wormhole; |
|
||||||
|
|
||||||
// query column 'm'$id2
|
|
||||||
id2 = id2s[index]; |
|
||||||
int keysize = appendRowKeyForMeta(rowkeysize, keybuf, id2);
|
|
||||||
rocksdb::Slice ckey(keybuf, keysize); |
|
||||||
iter->Seek(ckey); |
|
||||||
if (!iter->Valid()) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"Unable to find m$id2 ", |
|
||||||
assocType, id1, id2, 0, 0, 0, Trocksdb::UNUSED1); |
|
||||||
} |
|
||||||
if (ckey != iter->key()) { |
|
||||||
continue; // non existant assoc
|
|
||||||
} |
|
||||||
rocksdb::Slice value = iter->value(); |
|
||||||
if (value.size() != sizeof(int64_t) + sizeof(int8_t)) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"Unable to find m$id2 ", |
|
||||||
assocType, id1, id2, 0, 0, 0, Trocksdb::UNUSED1); |
|
||||||
} |
|
||||||
|
|
||||||
extractTsVisString(&ts, &oldvis, (char*)value.data_); |
|
||||||
if(oldvis != AssocVisibility::VISIBLE) { |
|
||||||
continue; |
|
||||||
} |
|
||||||
ASSERT_NE(ts, 0); |
|
||||||
|
|
||||||
// this assoc is visible, scan 'p'$ts$id2 to retrieve payload.
|
|
||||||
keysize = appendRowKeyForPayload(rowkeysize, keybuf, ts, id2);
|
|
||||||
rocksdb::Slice pkey(keybuf, keysize); |
|
||||||
iter->Seek(pkey); |
|
||||||
if (!iter->Valid() || (pkey != iter->key())) { |
|
||||||
throw generate_exception(tableName, Code::kNotFound, |
|
||||||
"Unable to find p$ts$id2 ", |
|
||||||
assocType, id1, id2, 0, 0, ts, Trocksdb::UNUSED1); |
|
||||||
} |
|
||||||
|
|
||||||
// allocate a new slot in the result set.
|
|
||||||
_return.resize(_return.size() + 1); |
|
||||||
TaoAssocGetResult* result = &_return.back(); |
|
||||||
|
|
||||||
// Fill up new element in result set.
|
|
||||||
result->id2 = id2; |
|
||||||
result->time = convertTime(ts); |
|
||||||
extractPayload((char *)iter->value().data_, &result->id1Type,
|
|
||||||
&result->id2Type, |
|
||||||
&result->dataVersion, result->data, wormhole); |
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
// fill the row key and returns the size of the key
|
|
||||||
inline int makeRowKey(char* dest, int64_t id1, int64_t assocType) { |
|
||||||
dest = copy_int64_switch_endian(dest, id1); |
|
||||||
dest = copy_int64_switch_endian(dest, assocType); |
|
||||||
return sizeof(id1) + sizeof(assocType); |
|
||||||
} |
|
||||||
|
|
||||||
// fill the row key +'c' and returns the size of the key
|
|
||||||
inline int appendRowKeyForCount(int rowkeysize, char* dest) { |
|
||||||
dest += rowkeysize; |
|
||||||
*dest = 'c'; |
|
||||||
return rowkeysize + 1; |
|
||||||
} |
|
||||||
|
|
||||||
// fill the row key +'p' + $ts$id2 and returns the size of the key
|
|
||||||
inline int appendRowKeyForPayload(int rowkeysize, char* dest, |
|
||||||
int64_t ts, int64_t id2) { |
|
||||||
dest += rowkeysize; |
|
||||||
*dest++ = 'p'; |
|
||||||
dest = copy_int64_switch_endian(dest, ts); |
|
||||||
dest = copy_int64_switch_endian(dest, id2); |
|
||||||
return rowkeysize + sizeof(ts) + sizeof(id2) + 1; |
|
||||||
} |
|
||||||
|
|
||||||
// extract the timestamp and id2 from the key p$ts$id2
|
|
||||||
inline void extractRowKeyP(int64_t* ts, int64_t* id,
|
|
||||||
int rowkeysize, char* src) { |
|
||||||
src += rowkeysize; // skip over the rowkey
|
|
||||||
ASSERT_EQ(*src, 'p'); |
|
||||||
src++; |
|
||||||
extract_int64(ts, src); src += sizeof(*ts); |
|
||||||
extract_int64(id, src); src += sizeof(*id); |
|
||||||
} |
|
||||||
|
|
||||||
// fill the row key +'m' + id2 and returns the size of the key
|
|
||||||
inline int appendRowKeyForMeta(int rowkeysize, char* dest,
|
|
||||||
int64_t id2) { |
|
||||||
dest += rowkeysize; |
|
||||||
*dest++ = 'm'; |
|
||||||
dest = copy_int64_switch_endian(dest, id2); |
|
||||||
return rowkeysize + sizeof(id2) + 1; |
|
||||||
} |
|
||||||
|
|
||||||
// fill the row key +'d' + id2 and returns the size of the key
|
|
||||||
inline int appendRowKeyForDelete(int rowkeysize, char* dest,
|
|
||||||
int64_t id2) { |
|
||||||
dest += rowkeysize; |
|
||||||
*dest++ = 'd'; |
|
||||||
dest = copy_int64_switch_endian(dest, id2); |
|
||||||
return rowkeysize + sizeof(id2) + 1; |
|
||||||
} |
|
||||||
|
|
||||||
// encode id1Type, id2Type, dataversion, etc into the payload
|
|
||||||
void makePayload(char* dest, int64_t id1Type, int64_t id2Type, |
|
||||||
int64_t dataVersion, const Text& data,
|
|
||||||
const Text& wormhole_comment) { |
|
||||||
int32_t datasize = data.size(); |
|
||||||
int32_t wormhole_commentsize = wormhole_comment.size(); |
|
||||||
|
|
||||||
dest = copy_int64_switch_endian(dest, id1Type); |
|
||||||
dest = copy_int64_switch_endian(dest, id2Type); |
|
||||||
dest = copy_int64_switch_endian(dest, dataVersion); |
|
||||||
dest = copy_int32(dest, datasize); |
|
||||||
dest = copy_int32(dest, wormhole_commentsize); |
|
||||||
memcpy(dest, data.data(), data.size()); |
|
||||||
dest += data.size(); |
|
||||||
memcpy(dest, wormhole_comment.data(), wormhole_comment.size()); |
|
||||||
dest += wormhole_comment.size(); |
|
||||||
} |
|
||||||
|
|
||||||
// extract id1Type, id2Type, dataversion, etc from payload
|
|
||||||
void extractPayload(char* dest, int64_t* id1Type, int64_t* id2Type, |
|
||||||
int64_t* dataVersion, Text& data,
|
|
||||||
Text& wormhole_comment) { |
|
||||||
int32_t datasize, wormsize; |
|
||||||
extract_int64(id1Type, dest); dest += sizeof(*id1Type); |
|
||||||
extract_int64(id2Type, dest); dest += sizeof(*id2Type); |
|
||||||
extract_int64(dataVersion, dest); dest += sizeof(*dataVersion); |
|
||||||
extract_int32(&datasize, dest); dest += sizeof(datasize); |
|
||||||
extract_int32(&wormsize, dest); dest += sizeof(wormsize); |
|
||||||
|
|
||||||
data.assign(dest, datasize); dest += datasize; |
|
||||||
wormhole_comment.assign(dest, wormsize); dest += wormsize; |
|
||||||
} |
|
||||||
|
|
||||||
// fill the timestamp and visibility
|
|
||||||
inline void makeTsVisString(char* dest, int64_t ts, int8_t vis) { |
|
||||||
dest = copy_int64_switch_endian(dest, ts); |
|
||||||
*dest = vis; |
|
||||||
} |
|
||||||
|
|
||||||
// extracts the timestamp and visibility from a byte stream
|
|
||||||
inline void extractTsVisString(int64_t* ts, int8_t* vis, char* src) { |
|
||||||
extract_int64(ts, src); |
|
||||||
extract_int8(vis, src + sizeof(*ts)); |
|
||||||
} |
|
||||||
|
|
||||||
// fill the count value
|
|
||||||
inline void makeCountString(char* dest, int64_t count) { |
|
||||||
dest = copy_int64_switch_endian(dest, count); |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// Switch endianess of the id and copy it to dest.
|
|
||||||
// Returns the updated destination address
|
|
||||||
//
|
|
||||||
inline char* copy_int64_switch_endian(char* dest, int64_t id) { |
|
||||||
char* src = (char *)&id + sizeof(id) - 1; |
|
||||||
for (unsigned int i = 0; i < sizeof(id); i++) { |
|
||||||
*dest++ = *src--;
|
|
||||||
} |
|
||||||
return dest; |
|
||||||
} |
|
||||||
|
|
||||||
// extracts a int64 type from the char stream. Swaps endianness.
|
|
||||||
inline void extract_int64(int64_t* dest, char* src) { |
|
||||||
char* d = (char *)dest; |
|
||||||
src += sizeof(int64_t) - 1; |
|
||||||
for (unsigned int i = 0; i < sizeof(uint64_t); i++) { |
|
||||||
*d++ = *src--;
|
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
//
|
|
||||||
// copy a 4 byte quantity to byte stream. swap endianess.
|
|
||||||
//
|
|
||||||
inline char* copy_int32(char* dest, int32_t id) { |
|
||||||
char* src = (char *)&id + sizeof(id) - 1; |
|
||||||
for (unsigned int i = 0; i < sizeof(id); i++) { |
|
||||||
*dest++ = *src--;
|
|
||||||
} |
|
||||||
return dest; |
|
||||||
} |
|
||||||
|
|
||||||
// extract a 4 byte quantity from a byte stream
|
|
||||||
inline void extract_int32(int32_t* dest, char* src) { |
|
||||||
char* d = (char *)dest; |
|
||||||
src += sizeof(int32_t) - 1; |
|
||||||
for (unsigned int i = 0; i < sizeof(*dest); i++) { |
|
||||||
*d++ = *src--;
|
|
||||||
} |
|
||||||
} |
|
||||||
|
|
||||||
// extracts a 1 byte integer from the char stream.
|
|
||||||
inline void extract_int8(int8_t* dest, char* src) { |
|
||||||
*dest = *(int8_t *)src; |
|
||||||
} |
|
||||||
|
|
||||||
// convert a timestamp from an ever-increasing number to
|
|
||||||
// a decreasing number. All stored timestamps in this database
|
|
||||||
// are MAXLONG - timestamp. Thus, a backward-scan in time
|
|
||||||
// is converted to a forward scan in the database.
|
|
||||||
inline int64_t convertTime(int64_t ts) { |
|
||||||
return LONG_MAX - ts; |
|
||||||
} |
|
||||||
|
|
||||||
|
|
||||||
// generate an exception message
|
|
||||||
LeveldbException generate_exception(const Text& tableName, |
|
||||||
Code errorCode, const char* message, |
|
||||||
int64_t assocType, int64_t id1,
|
|
||||||
int64_t id2, int64_t id1Type, int64_t id2Type,
|
|
||||||
int64_t ts, AssocVisibility vis) { |
|
||||||
char result[1024]; |
|
||||||
sprintf(result,
|
|
||||||
"id1=%ld assocType=%ld id2=%ld id1Type=%ld id2Type=%ld ts=%ld vis=%d ",
|
|
||||||
id1, assocType, id2, id1Type, id2Type, ts, vis); |
|
||||||
fprintf(stderr, "assoc_server error table %s: %s errorCode=%d %s", |
|
||||||
tableName.c_str(), message, errorCode, result); |
|
||||||
|
|
||||||
LeveldbException e; |
|
||||||
e.errorCode = errorCode; |
|
||||||
e.message = message; |
|
||||||
throw e; |
|
||||||
} |
|
||||||
|
|
||||||
}; |
|
||||||
|
|
||||||
#endif // THRIFT_LEVELDB_ASSOC_SERVER_H_
|
|
Binary file not shown.
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in new issue