Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Tag schema region #7

Open
wants to merge 15 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
28 changes: 28 additions & 0 deletions lsm/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
<?xml version="1.0" encoding="UTF-8"?>
<!--
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.
-->
<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">
<parent>
<artifactId>iotdb-parent</artifactId>
<groupId>org.apache.iotdb</groupId>
<version>0.14.0-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
<modelVersion>4.0.0</modelVersion>
<artifactId>iotdb-lsm</artifactId>
<name>IoTDB lsm</name>
</project>
111 changes: 111 additions & 0 deletions lsm/src/main/java/org/apache/iotdb/lsm/context/Context.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,111 @@
/*
* 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.
*/
package org.apache.iotdb.lsm.context;

import org.apache.iotdb.lsm.strategy.AccessStrategy;
import org.apache.iotdb.lsm.strategy.PreOrderAccessStrategy;

public class Context {

// 类型
ContextType type;

// 访问策略
AccessStrategy accessStrategy;

// 所处的树深度
int level;

// 多少个线程处理该节点的子节点
int threadNums;

// 上界,大于该值的层级不会被处理
int levelUpperBound;

// 返回值
Object result;

// 是否正在recover
boolean recover;

public Context() {
accessStrategy = new PreOrderAccessStrategy();
type = ContextType.NONE;
level = 0;
threadNums = 1;
levelUpperBound = Integer.MAX_VALUE;
recover = false;
}

public void setLevel(int level) {
this.level = level;
}

public int getLevel() {
return level;
}

public ContextType getType() {
return type;
}

public int getThreadNums() {
return threadNums;
}

public void setType(ContextType type) {
this.type = type;
}

public void setThreadNums(int threadNums) {
this.threadNums = threadNums;
}

public Object getResult() {
return result;
}

public void setResult(Object result) {
this.result = result;
}

public AccessStrategy getAccessStrategy() {
return accessStrategy;
}

public void setAccessStrategy(AccessStrategy accessStrategy) {
this.accessStrategy = accessStrategy;
}

public int getLevelUpperBound() {
return levelUpperBound;
}

public void setLevelUpperBound(int levelUpperBound) {
this.levelUpperBound = levelUpperBound;
}

public boolean isRecover() {
return recover;
}

public void setRecover(boolean recover) {
this.recover = recover;
}
}
27 changes: 27 additions & 0 deletions lsm/src/main/java/org/apache/iotdb/lsm/context/ContextType.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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.
*/
package org.apache.iotdb.lsm.context;

public enum ContextType {
NONE,
INSERT,
QUERY,
DELETE,
FLUSH;
}
71 changes: 71 additions & 0 deletions lsm/src/main/java/org/apache/iotdb/lsm/context/DeleteContext.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,71 @@
/*
* 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.
*/
package org.apache.iotdb.lsm.context;

import org.apache.iotdb.lsm.strategy.PostOrderAccessStrategy;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class DeleteContext extends Context {

List<Object> keys;

Object value;

public DeleteContext() {
super();
type = ContextType.DELETE;
accessStrategy = new PostOrderAccessStrategy();
}

public DeleteContext(Object value, Object... ks) {
super();
this.value = value;
keys = new ArrayList<>();
keys.addAll(Arrays.asList(ks));
type = ContextType.DELETE;
accessStrategy = new PostOrderAccessStrategy();
}

public void setKeys(List<Object> keys) {
this.keys = keys;
}

public void setValue(Object value) {
this.value = value;
}

public Object getKey() {
return keys.get(level);
}

public List<Object> getKeys() {
return keys;
}

public Object getValue() {
return value;
}

public int size() {
return keys.size();
}
}
27 changes: 27 additions & 0 deletions lsm/src/main/java/org/apache/iotdb/lsm/context/FlushContext.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
/*
* 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.
*/
package org.apache.iotdb.lsm.context;

import org.apache.iotdb.lsm.strategy.RBFSAccessStrategy;

public class FlushContext extends Context {
public FlushContext() {
accessStrategy = new RBFSAccessStrategy();
}
}
67 changes: 67 additions & 0 deletions lsm/src/main/java/org/apache/iotdb/lsm/context/InsertContext.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,67 @@
/*
* 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.
*/
package org.apache.iotdb.lsm.context;

import org.apache.iotdb.lsm.strategy.PreOrderAccessStrategy;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class InsertContext extends Context {

List<Object> keys;

Object value;

public InsertContext() {
super();
type = ContextType.INSERT;
accessStrategy = new PreOrderAccessStrategy();
}

public InsertContext(Object value, Object... keys) {
super();
this.value = value;
this.keys = new ArrayList<>();
this.keys.addAll(Arrays.asList(keys));
type = ContextType.INSERT;
accessStrategy = new PreOrderAccessStrategy();
}

public Object getKey() {
return keys.get(level);
}

public void setKeys(List<Object> keys) {
this.keys = keys;
}

public void setValue(Object value) {
this.value = value;
}

public List<Object> getKeys() {
return keys;
}

public Object getValue() {
return value;
}
}
46 changes: 46 additions & 0 deletions lsm/src/main/java/org/apache/iotdb/lsm/context/QueryContext.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
/*
* 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.
*/
package org.apache.iotdb.lsm.context;

import org.apache.iotdb.lsm.strategy.PostOrderAccessStrategy;

import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;

public class QueryContext extends Context {

List<Object> keys;

public QueryContext(Object... ks) {
super();
keys = new ArrayList<>();
keys.addAll(Arrays.asList(ks));
type = ContextType.QUERY;
accessStrategy = new PostOrderAccessStrategy();
}

public Object getKey() {
return keys.get(level);
}

public int size() {
return keys.size();
}
}
Loading