Skip to content

Commit

Permalink
Rename extension to pgvectorscale
Browse files Browse the repository at this point in the history
  • Loading branch information
cevian committed May 29, 2024
1 parent a62de4d commit 51d7fd8
Show file tree
Hide file tree
Showing 46 changed files with 43 additions and 31 deletions.
2 changes: 1 addition & 1 deletion .dockerignore
Original file line number Diff line number Diff line change
@@ -1 +1 @@
timescale_vector/target
pgvectorscale/target
2 changes: 1 addition & 1 deletion .github/actions/install-pgrx/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ runs:
working-directory: ${{ inputs.vector-dir }}
# rustup show active-toolchain installs the toolchain specified via rust-toolchain.yaml if it is not installed
run: |
cd timescale_vector
cd pgvectorscale
RUST_VERSION=`rustup show active-toolchain -v | grep rustc | cut -d' ' -f2`
echo "version=$RUST_VERSION" >> $GITHUB_OUTPUT
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/code_checks.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,10 +12,10 @@ jobs:
uses: actions/checkout@v3
# extension is small so we do the hacky thing.
# - name: Run Cargo tests
# run: cd timescale_vector && cargo install --locked cargo-pgrx && cargo pgrx init && cargo pgrx test && cd ..
# run: cd pgvectorscale && cargo install --locked cargo-pgrx && cargo pgrx init && cargo pgrx test && cd ..

- name: Verify formatting
run: cd timescale_vector && cargo fmt --check
run: cd pgvectorscale && cargo fmt --check

- name: Check formatting failure
if: failure()
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/deb-packager.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ jobs:
MAKE_JOBS: 6
PG_CONFIG_PATH: postgresql/bin/pg_config
TAG: ${{ github.event.inputs.tag }}
TAG_DIR: timescale_vector
TAG_DIR: pgvectorscale

steps:
- name: Checkout Timescale Vector
Expand Down
6 changes: 3 additions & 3 deletions Makefile
Original file line number Diff line number Diff line change
@@ -1,15 +1,15 @@
SHELL:=/bin/bash
ROOTDIR = $(realpath .)
RUST_SRCDIR =$(ROOTDIR)/timescale_vector
RUST_SRCDIR =$(ROOTDIR)/pgvectorscale

PG_CONFIG = $(shell which pg_config)
EXTENSION=timescale_vector
EXTENSION=vectorscale

PG_VERSION = $(shell ${PG_CONFIG} --version | awk -F'[ \.]' '{print $$2}')
##TODO error out if this is not PG14???
PGRX_HOME?= ${HOME}/.pgrx
PGRX_VERSION=0.9.8
VECTOR_VERSION?=$(shell sed -n 's/^[[:space:]]*version[[:space:]]*=[[:space:]]*"\(.*\)"/\1/p' timescale_vector/Cargo.toml)
VECTOR_VERSION?=$(shell sed -n 's/^[[:space:]]*version[[:space:]]*=[[:space:]]*"\(.*\)"/\1/p' pgvectorscale/Cargo.toml)
PG_DATA=${PGRX_HOME}/data-${PG_VERSION}

PG_PKGLIBDIR=$(shell ${PG_CONFIG} --pkglibdir)
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ Installing from source is also available on macOS and requires the same set of p
Download or clone this repository, and switch to the extension subdirectory, e.g.
```shell
git clone https://github.com/timescale/timescale-vector && \
cd timescale-vector/timescale_vector
cd timescale-vector/pgvectorscale
```

Then run
Expand All @@ -44,7 +44,7 @@ cargo pgrx install --release
To initialize the extension after installation, enter the following into psql:

```sql
CREATE EXTENSION timescale_vector;
CREATE EXTENSION vectorscale;
```

✏️ Get Involved
Expand Down
File renamed without changes.
4 changes: 2 additions & 2 deletions timescale_vector/Cargo.toml → pgvectorscale/Cargo.toml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "timescale_vector"
name = "vectorscale"
version = "0.0.3-dev"
edition = "2021"

Expand All @@ -26,7 +26,7 @@ rand_chacha = "0.3"
rand_core = "0.6"
rand_xorshift = "0.3"
rayon = "1"
timescale_vector_derive = { path = "timescale_vector_derive" }
pgvectorscale_derive = { path = "pgvectorscale_derive" }
semver = "1.0.22"

[dev-dependencies]
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
use criterion::{black_box, criterion_group, criterion_main, Criterion};
use timescale_vector::access_method::distance::{
use pgvectorscale::access_method::distance::{
distance_cosine, distance_l2, distance_l2_optimized_for_few_dimensions,
distance_l2_unoptimized, distance_xor_optimized,
};
Expand Down
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
[package]
name = "timescale_vector_derive"
name = "pgvectorscale_derive"
version = "0.1.0"
edition = "2021"

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -5,9 +5,9 @@ The ordering of items is not stable, it is driven by a dependency graph.
*/

-- src/access_method/mod.rs:48
-- timescale_vector::access_method::amhandler
-- pgvectorscale::access_method::amhandler

CREATE OR REPLACE FUNCTION tsv_amhandler(internal) RETURNS index_am_handler PARALLEL SAFE IMMUTABLE STRICT COST 0.0001 LANGUAGE c AS '$libdir/timescale_vector-0.0.3-dev', 'amhandler_wrapper';
CREATE OR REPLACE FUNCTION tsv_amhandler(internal) RETURNS index_am_handler PARALLEL SAFE IMMUTABLE STRICT COST 0.0001 LANGUAGE c AS '$libdir/pgvectorscale-0.0.3-dev', 'amhandler_wrapper';

DO $$
DECLARE
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
use pgrx::pg_sys::{BufferGetBlockNumber, InvalidBlockNumber, InvalidOffsetNumber};
use pgrx::*;
use pgvectorscale_derive::{Readable, Writeable};
use rkyv::{Archive, Deserialize, Serialize};
use semver::Version;
use timescale_vector_derive::{Readable, Writeable};

use crate::access_method::options::TSVIndexOptions;
use crate::util::page;
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -2,9 +2,9 @@ use std::pin::Pin;

use pgrx::pg_sys::{InvalidBlockNumber, InvalidOffsetNumber};
use pgrx::*;
use pgvectorscale_derive::{Readable, Writeable};
use rkyv::vec::ArchivedVec;
use rkyv::{Archive, Deserialize, Serialize};
use timescale_vector_derive::{Readable, Writeable};

use super::neighbor_with_distance::NeighborWithDistance;
use super::storage::ArchivedData;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -741,7 +741,7 @@ impl<'a> Storage for SbqSpeedupStorage<'a> {
}
}

use timescale_vector_derive::{Readable, Writeable};
use pgvectorscale_derive::{Readable, Writeable};

#[derive(Archive, Deserialize, Serialize, Readable, Writeable)]
#[archive(check_bytes)]
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,9 @@ pub mod tests {
let entry = entry?;
let ty = entry.file_type()?;
if ty.is_dir() {
if entry.file_name() == "target" {
continue;
}
copy_dir_all(entry.path(), dst.as_ref().join(entry.file_name()))?;
} else {
fs::copy(entry.path(), dst.as_ref().join(entry.file_name()))?;
Expand All @@ -33,7 +36,7 @@ pub mod tests {

client
.execute(
&format!("DROP EXTENSION IF EXISTS timescale_vector CASCADE;"),
&format!("DROP EXTENSION IF EXISTS vectorscale CASCADE;"),
&[],
)
.unwrap();
Expand Down Expand Up @@ -98,7 +101,7 @@ pub mod tests {
.unwrap();
assert!(res.status.success(), "failed: {:?}", res);

//let contents = fs::read_to_string(temp_path.join("timescale_vector/Cargo.toml")).unwrap();
//let contents = fs::read_to_string(temp_path.join("pgvectorscale/Cargo.toml")).unwrap();
//print!("cargo {}", contents);

let res = std::process::Command::new("cargo")
Expand Down Expand Up @@ -172,12 +175,21 @@ pub mod tests {
.unwrap();
assert!(res.status.success(), "failed: {:?}", res);

client
.execute(
&format!(
"UPDATE pg_extension SET extname='vectorscale' WHERE extname = 'timescale_vector';",
),
&[],
)
.unwrap();

//need to recreate the client to avoid double load of GUC. Look into this later.
let (mut client, _) = pgrx_tests::client().unwrap();
client
.execute(
&format!(
"ALTER EXTENSION timescale_vector UPDATE TO '{}'",
"ALTER EXTENSION vectorscale UPDATE TO '{}'",
env!("CARGO_PKG_VERSION")
),
&[],
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
6 changes: 6 additions & 0 deletions pgvectorscale/vectorscale.control
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
comment = 'pgvectorscale: Advanced indexing for vector data'
default_version = '@CARGO_VERSION@'
#module_pathname = '$libdir/pgvectorscale'
relocatable = false
superuser = true
requires = 'vector'
6 changes: 3 additions & 3 deletions scripts/package-deb.sh
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ DEBHELPER_COMPAT=11
set -ex

OS_NAME="${3}"
BASEDIR="${2}"/timescale_vector
BASEDIR="${2}"/pgvectorscale
DEBDIR="${PWD}"/pkgdump
TIMESCALE_VECTOR_VERSION="${1}"
PG_VERSIONS="${4}"
Expand Down Expand Up @@ -61,8 +61,8 @@ Depends: postgresql-$pg
Description: Timescale Vector Extension for Cloud
EOF

echo "target/release/timescale_vector-pg$pg/$libdir/* usr/lib/postgresql/$pg/lib/" >"${BASEDIR}"/debian/timescale-vector-postgresql-"$pg".install
echo "target/release/timescale_vector-pg$pg/$sharedir/* usr/share/postgresql/$pg/" >>"${BASEDIR}"/debian/timescale-vector-postgresql-"$pg".install
echo "target/release/pgvectorscale-pg$pg/$libdir/* usr/lib/postgresql/$pg/lib/" >"${BASEDIR}"/debian/timescale-vector-postgresql-"$pg".install
echo "target/release/pgvectorscale-pg$pg/$sharedir/* usr/share/postgresql/$pg/" >>"${BASEDIR}"/debian/timescale-vector-postgresql-"$pg".install
done

dpkg-buildpackage --build=binary --no-sign --post-clean
Expand Down
6 changes: 0 additions & 6 deletions timescale_vector/timescale_vector.control

This file was deleted.

0 comments on commit 51d7fd8

Please sign in to comment.