ydb BucketAware interface
This commit is contained in:
@@ -1,23 +1,15 @@
|
||||
package ydb
|
||||
|
||||
const (
|
||||
createQuery = `
|
||||
PRAGMA TablePathPrefix("%s");
|
||||
CREATE TABLE file_meta (
|
||||
dir_hash int64,
|
||||
name Utf8,
|
||||
directory Utf8,
|
||||
meta String,
|
||||
PRIMARY KEY (dir_hash, name)
|
||||
);`
|
||||
import asql "github.com/chrislusf/seaweedfs/weed/filer/abstract_sql"
|
||||
|
||||
const (
|
||||
insertQuery = `
|
||||
DECLARE $dir_hash int64;
|
||||
DECLARE $name AS Utf8;
|
||||
DECLARE $directory AS Utf8;
|
||||
DECLARE $meta AS String;
|
||||
|
||||
UPSERT INTO file_meta
|
||||
UPSERT INTO ` + asql.DEFAULT_TABLE + `
|
||||
(dir_hash, name, directory, meta)
|
||||
VALUES
|
||||
($dir_hash, $name, $directory, $meta);`
|
||||
@@ -28,7 +20,7 @@ const (
|
||||
DECLARE $directory AS Utf8;
|
||||
DECLARE $meta AS String;
|
||||
|
||||
REPLACE INTO file_meta
|
||||
REPLACE INTO ` + asql.DEFAULT_TABLE + `
|
||||
(dir_hash, name, directory, meta)
|
||||
VALUES
|
||||
($dir_hash, $name, $directory, $meta)
|
||||
@@ -38,7 +30,7 @@ const (
|
||||
DECLARE $dir_hash int64;
|
||||
DECLARE $name AS Utf8;
|
||||
|
||||
DELETE FROM file_meta
|
||||
DELETE FROM ` + asql.DEFAULT_TABLE + `
|
||||
WHERE dir_hash == $dir_hash AND name == $name;
|
||||
COMMIT;`
|
||||
|
||||
@@ -54,11 +46,11 @@ const (
|
||||
DECLARE $dir_hash int64;
|
||||
DECLARE $directory AS Utf8;
|
||||
|
||||
DELETE FROM file_meta
|
||||
DELETE FROM ` + asql.DEFAULT_TABLE + `
|
||||
WHERE dir_hash == $dir_hash AND directory == $directory;
|
||||
COMMIT;`
|
||||
|
||||
ListDirectoryQuery = `
|
||||
listDirectoryQuery = `
|
||||
DECLARE $dir_hash int64;
|
||||
DECLARE $directory AS Utf8;
|
||||
DECLARE $start_name AS Utf8;
|
||||
@@ -66,7 +58,7 @@ const (
|
||||
DECLARE $limit AS int64;
|
||||
|
||||
SELECT name, meta
|
||||
FROM file_meta
|
||||
FROM ` + asql.DEFAULT_TABLE + `
|
||||
WHERE dir_hash == $dir_hash AND directory == $directory and name %s $start_name and name LIKE '$prefix%%'
|
||||
ORDER BY name ASC LIMIT $limit;`
|
||||
)
|
||||
|
||||
Reference in New Issue
Block a user