Skip to content

Commit

Permalink
Initial public release (#1)
Browse files Browse the repository at this point in the history
* Initial public release
  • Loading branch information
StrongestNumber9 authored Jan 19, 2023
1 parent 4df8a81 commit 89c2139
Show file tree
Hide file tree
Showing 14 changed files with 984 additions and 2 deletions.
33 changes: 33 additions & 0 deletions .github/workflows/maven-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Maven Package

on:
push:

jobs:
build:

runs-on: ubuntu-latest
permissions:
contents: read
packages: write

steps:
- uses: actions/checkout@v3
with:
fetch-depth: 0

- name: Set up JDK 8
uses: actions/setup-java@v3
with:
java-version: '8'
distribution: 'temurin'
server-id: github
settings-path: ${{ github.workspace }}

- name: Get version
run: echo "RELEASE_VERSION=$(git describe --tags)" >> $GITHUB_ENV

- name: Publish to GitHub Packages Apache Maven
run: mvn -B -Drevision=${{ env.RELEASE_VERSION }} -Dsha1= -Dchangelist= deploy -s ${{ github.workspace }}/settings.xml
env:
GITHUB_TOKEN: ${{ github.token }}
5 changes: 5 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
/target/**
/target/
.flattened-pom.xml
.idea/**
rlp_01.iml
30 changes: 28 additions & 2 deletions LICENSE
Original file line number Diff line number Diff line change
Expand Up @@ -633,8 +633,8 @@ the "copyright" line and a pointer to where the full notice is found.
Copyright (C) <year> <name of author>

This program is free software: you can redistribute it and/or modify
it under the terms of the GNU Affero General Public License as published
by the Free Software Foundation, either version 3 of the License, or
it under the terms of the GNU Affero General Public License as published by
the Free Software Foundation, either version 3 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
Expand All @@ -659,3 +659,29 @@ specific requirements.
if any, to sign a "copyright disclaimer" for the program, if necessary.
For more information on this, and how to apply and follow the GNU AGPL, see
<https://www.gnu.org/licenses/>.

Additional permission under GNU Affero General Public License version 3
section 7

If you modify this Program, or any covered work, by linking or combining it with
other code, such other code is not for that reason alone subject to any of the
requirements of the GNU Affero GPL version 3 as long as this Program is the same
Program as licensed from Suomen Kanuuna Oy without any additional modifications.

Supplemented terms under GNU Affero General Public License version 3
section 7

Origin of the software must be attributed to Suomen Kanuuna Oy. Any modified
versions must be marked as "Modified version of" The Program.

Names of the licensors and authors may not be used for publicity purposes.

No rights are granted for use of trade names, trademarks, or service marks
which are in The Program if any.

Licensee must indemnify licensors and authors for any liability that these
contractual assumptions impose on licensors and authors.

To the extent this program is licensed as part of the Commercial versions of
Teragrep, the applicable Commercial License may apply to this file if you as
a licensee so wish it.
17 changes: 17 additions & 0 deletions astyle-options.ini
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
--formatted
--indent=spaces=4
--indent-switches
--pad-oper
--pad-paren-in
--unpad-paren
--align-pointer=type
--align-reference=type
--break-one-line-headers
--add-braces
--add-one-line-braces
--remove-comment-prefix
--max-code-length=80
--break-after-logical
--suffix=none
--style=otbs
--convert-tabs
177 changes: 177 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,177 @@
<?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">
<packaging>jar</packaging>
<modelVersion>4.0.0</modelVersion>
<artifactId>blf_01</artifactId>
<name>blf_01</name>
<description>blf_01</description>
<groupId>com.teragrep</groupId>
<version>${revision}${sha1}${changelist}</version>
<url>https://teragrep.com</url>
<properties>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<revision>0.0.1</revision>
<changelist>-SNAPSHOT</changelist>
<sha1/>
<java.version>1.8</java.version>
<maven.compiler.source>1.8</maven.compiler.source>
<maven.compiler.target>1.8</maven.compiler.target>
</properties>
<scm>
<connection>scm:git:https://github.com/teragrep/blf_01.git</connection>
<developerConnection>scm:git:git@github.com:teragrep/blf_01.git</developerConnection>
<url>https://github.com/teragrep/blf_01/tree/master</url>
</scm>
<dependencies>
<!-- maria -->
<dependency>
<groupId>org.mariadb.jdbc</groupId>
<artifactId>mariadb-java-client</artifactId>
<version>3.0.3</version>
</dependency>
<!-- bloom -->
<dependency>
<groupId>org.apache.spark</groupId>
<artifactId>spark-sketch_2.12</artifactId>
<version>2.4.5</version>
</dependency>
<!-- benchmarking -->
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-core</artifactId>
<version>1.33</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.openjdk.jmh</groupId>
<artifactId>jmh-generator-annprocess</artifactId>
<version>1.33</version>
<scope>test</scope>
</dependency>
<!-- tests -->
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-engine</artifactId>
<version>5.7.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.platform</groupId>
<artifactId>junit-platform-launcher</artifactId>
<version>1.7.1</version>
<scope>test</scope>
</dependency>
<dependency>
<groupId>org.junit.jupiter</groupId>
<artifactId>junit-jupiter-api</artifactId>
<version>5.8.2</version>
<scope>test</scope>
</dependency>
</dependencies>

<build>
<directory>${project.basedir}/target</directory>
<finalName>blf_01</finalName>
<plugins>
<plugin>
<groupId>org.apache.rat</groupId>
<artifactId>apache-rat-plugin</artifactId>
<version>0.15</version>
<inherited>false</inherited>
<executions>
<execution>
<phase>test</phase>
<goals>
<goal>check</goal>
</goals>
</execution>
</executions>
<configuration>
<addDefaultLicenseMatchers>false</addDefaultLicenseMatchers>
<licenses>
<license implementation="org.apache.rat.analysis.license.SimplePatternBasedLicense">
<notes>Also allow the license url to be https.</notes>
<patterns>
<pattern>https://github.com/teragrep/teragrep/blob/main/LICENSE</pattern>
</patterns>
</license>
</licenses>
<consoleOutput>true</consoleOutput>
<excludeSubProjects>false</excludeSubProjects>
<excludes>
<!-- git -->
<exclude>.git/**</exclude>
<exclude>.gitattributes</exclude>
<exclude>.gitignore</exclude>
<exclude>.gitmodules</exclude>
<!-- ci -->
<exclude>.github/workflows/*.yml</exclude>
<exclude>toolchains.xml</exclude>
<exclude>settings.xml</exclude>
<!-- readme -->
<exclude>README.adoc</exclude>
<exclude>README.md</exclude>
<!-- astyle -->
<exclude>astyle-options.ini</exclude>
</excludes>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-surefire-plugin</artifactId>
<version>2.22.2</version>
<configuration>
<parallel>all</parallel>
<useUnlimitedThreads>true</useUnlimitedThreads>
</configuration>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-failsafe-plugin</artifactId>
<version>3.0.0-M5</version>
<executions>
<execution>
<goals>
<goal>integration-test</goal>
<goal>verify</goal>
</goals>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>flatten-maven-plugin</artifactId>
<version>1.1.0</version>
<configuration>
<updatePomFile>true</updatePomFile>
<flattenMode>resolveCiFriendliesOnly</flattenMode>
</configuration>
<executions>
<execution>
<id>flatten</id>
<phase>process-resources</phase>
<goals>
<goal>flatten</goal>
</goals>
</execution>
<execution>
<id>flatten.clean</id>
<phase>clean</phase>
<goals>
<goal>clean</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
<distributionManagement>
<repository>
<id>github</id>
<url>https://maven.pkg.github.com/${env.GITHUB_REPOSITORY}</url>
</repository>
</distributionManagement>
</project>
92 changes: 92 additions & 0 deletions src/main/java/com/teragrep/blf_01/FilterManager.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
package com.teragrep.blf_01;

/*
* Teragrep Bloom Filter Library BLF-01
* Copyright (C) 2019, 2020, 2021, 2022 Suomen Kanuuna Oy
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU Affero General Public License as published by
* the Free Software Foundation, either version 3 of the License, 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 Affero General Public License for more details.
*
* You should have received a copy of the GNU Affero General Public License
* along with this program. If not, see <https://github.com/teragrep/teragrep/blob/main/LICENSE>.
*
*
* Additional permission under GNU Affero General Public License version 3
* section 7
*
* If you modify this Program, or any covered work, by linking or combining it
* with other code, such other code is not for that reason alone subject to any
* of the requirements of the GNU Affero GPL version 3 as long as this Program
* is the same Program as licensed from Suomen Kanuuna Oy without any additional
* modifications.
*
* Supplemented terms under GNU Affero General Public License version 3
* section 7
*
* Origin of the software must be attributed to Suomen Kanuuna Oy. Any modified
* versions must be marked as "Modified version of" The Program.
*
* Names of the licensors and authors may not be used for publicity purposes.
*
* No rights are granted for use of trade names, trademarks, or service marks
* which are in The Program if any.
*
* Licensee must indemnify licensors and authors for any liability that these
* contractual assumptions impose on licensors and authors.
*
* To the extent this program is licensed as part of the Commercial versions of
* Teragrep, the applicable Commercial License may apply to this file if you as
* a licensee so wish it.
*/

import org.apache.spark.util.sketch.BloomFilter;

import java.io.ByteArrayInputStream;
import java.io.ByteArrayOutputStream;

import java.io.IOException;

public class FilterManager {

private final long defaultSize = 90000L;


public FilterManager() {
}

public void select() throws IOException {
BloomFilter bloomFilter = BloomFilter.create(defaultSize, 0.001);
//System.out.println(bloomFilter.bitSize());

ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
bloomFilter.writeTo(outputStream);
ByteArrayInputStream is = new ByteArrayInputStream(outputStream.toByteArray());
/*
PreparedStatement stmt = con.prepareStatement( "SELECT * FROM bloomTable WHERE bloommatch( ?, bloomTable.filter );" );
stmt.setBlob( 1, is );
ResultSet rs = stmt.executeQuery();
*/
}

public void update() throws IOException {
BloomFilter bloomFilter = BloomFilter.create(defaultSize, 0.001);

ByteArrayOutputStream outputStream = new ByteArrayOutputStream();
bloomFilter.writeTo(outputStream);
ByteArrayInputStream is = new ByteArrayInputStream(outputStream.toByteArray());

/*
PreparedStatement stmt = con.prepareStatement( "UPDATE bloomTable SET filter=bloomupdate( ?, bloomTable.filter ) WHERE id=?;" );
stmt.setBlob( 1, is );
stmt.setint( 2, 5 );
stmt.executeUpdate();
*/
}
}
Loading

0 comments on commit 89c2139

Please sign in to comment.