Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
A
atlas
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
dataplatform
atlas
Commits
82209db0
Commit
82209db0
authored
Dec 23, 2014
by
Harish Butani
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
introduce ClassStore + TraitStore
parent
546efae9
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
113 additions
and
11 deletions
+113
-11
ClassStore.java
...org/apache/hadoop/metadata/storage/memory/ClassStore.java
+50
-0
HierarchicalTypeStore.java
...hadoop/metadata/storage/memory/HierarchicalTypeStore.java
+10
-8
MemRepository.java
.../apache/hadoop/metadata/storage/memory/MemRepository.java
+3
-3
TraitStore.java
...org/apache/hadoop/metadata/storage/memory/TraitStore.java
+50
-0
No files found.
typesystem/src/main/java/org/apache/hadoop/metadata/storage/memory/ClassStore.java
0 → 100644
View file @
82209db0
/**
* 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
.
hadoop
.
metadata
.
storage
.
memory
;
import
com.google.common.collect.ImmutableList
;
import
org.apache.hadoop.metadata.storage.ReferenceableInstance
;
import
org.apache.hadoop.metadata.storage.RepositoryException
;
import
org.apache.hadoop.metadata.types.ClassType
;
import
org.apache.hadoop.metadata.types.HierarchicalType
;
import
java.util.ArrayList
;
public
class
ClassStore
extends
HierarchicalTypeStore
{
final
ArrayList
<
ImmutableList
<
String
>>
traitNamesStore
;
public
ClassStore
(
MemRepository
repository
,
ClassType
hierarchicalType
)
throws
RepositoryException
{
super
(
repository
,
hierarchicalType
);
traitNamesStore
=
new
ArrayList
<
ImmutableList
<
String
>>();
}
void
store
(
ReferenceableInstance
i
)
throws
RepositoryException
{
super
.
store
(
i
);
int
pos
=
idPosMap
.
get
(
i
.
getId
());
traitNamesStore
.
set
(
pos
,
i
.
getTraits
());
}
public
void
ensureCapacity
(
int
pos
)
throws
RepositoryException
{
super
.
ensureCapacity
(
pos
);
while
(
traitNamesStore
.
size
()
<
pos
+
1
)
{
traitNamesStore
.
add
(
null
);
}
}
}
typesystem/src/main/java/org/apache/hadoop/metadata/storage/memory/HierarchicalTypeStore.java
View file @
82209db0
...
...
@@ -22,11 +22,9 @@ import com.google.common.collect.ImmutableBiMap;
import
com.google.common.collect.ImmutableList
;
import
com.google.common.collect.ImmutableMap
;
import
com.google.common.collect.Lists
;
import
org.apache.hadoop.metadata.storage.
Id
;
import
org.apache.hadoop.metadata.storage.
*
;
import
org.apache.hadoop.metadata.ITypedReferenceableInstance
;
import
org.apache.hadoop.metadata.storage.Id
;
import
org.apache.hadoop.metadata.storage.ReferenceableInstance
;
import
org.apache.hadoop.metadata.storage.RepositoryException
;
import
org.apache.hadoop.metadata.types.AttributeInfo
;
import
org.apache.hadoop.metadata.types.HierarchicalType
;
import
org.apache.hadoop.metadata.types.IConstructableType
;
...
...
@@ -34,7 +32,7 @@ import org.apache.hadoop.metadata.types.IConstructableType;
import
java.util.*
;
import
java.util.concurrent.locks.ReentrantReadWriteLock
;
public
class
HierarchicalTypeStore
{
public
abstract
class
HierarchicalTypeStore
{
final
MemRepository
repository
;
final
IConstructableType
hierarchicalType
;
...
...
@@ -145,6 +143,13 @@ public class HierarchicalTypeStore {
lock
.
writeLock
().
unlock
();
}
protected
void
storeFields
(
int
pos
,
StructInstance
s
)
throws
RepositoryException
{
for
(
Map
.
Entry
<
AttributeInfo
,
IAttributeStore
>
e
:
attrStores
.
entrySet
())
{
IAttributeStore
attributeStore
=
e
.
getValue
();
attributeStore
.
store
(
pos
,
hierarchicalType
,
s
);
}
}
/**
* - store the typeName
* - store the immediate attributes in the respective IAttributeStore
...
...
@@ -155,10 +160,7 @@ public class HierarchicalTypeStore {
void
store
(
ReferenceableInstance
i
)
throws
RepositoryException
{
int
pos
=
idPosMap
.
get
(
i
.
getId
());
typeNameList
.
set
(
pos
,
i
.
getTypeName
());
for
(
Map
.
Entry
<
AttributeInfo
,
IAttributeStore
>
e
:
attrStores
.
entrySet
())
{
IAttributeStore
attributeStore
=
e
.
getValue
();
attributeStore
.
store
(
pos
,
hierarchicalType
,
i
);
}
storeFields
(
pos
,
i
);
for
(
HierarchicalTypeStore
s
:
superTypeStores
)
{
s
.
store
(
i
);
...
...
typesystem/src/main/java/org/apache/hadoop/metadata/storage/memory/MemRepository.java
View file @
82209db0
...
...
@@ -187,7 +187,7 @@ public class MemRepository implements IRepository {
st
.
store
((
ReferenceableInstance
)
instance
);
for
(
String
traitName
:
instance
.
getTraits
())
{
HierarchicalTypeStore
tt
=
typeStores
.
get
(
traitName
);
// ??
tt
.
store
((
ReferenceableInstance
)
instance
);
}
}
}
catch
(
RepositoryException
re
)
{
...
...
@@ -228,12 +228,12 @@ public class MemRepository implements IRepository {
}
public
void
defineClass
(
ClassType
type
)
throws
RepositoryException
{
HierarchicalTypeStore
s
=
new
HierarchicalType
Store
(
this
,
type
);
HierarchicalTypeStore
s
=
new
Class
Store
(
this
,
type
);
typeStores
.
put
(
type
.
getName
(),
s
);
}
public
void
defineTrait
(
TraitType
type
)
throws
RepositoryException
{
HierarchicalTypeStore
s
=
new
HierarchicalType
Store
(
this
,
type
);
HierarchicalTypeStore
s
=
new
Trait
Store
(
this
,
type
);
typeStores
.
put
(
type
.
getName
(),
s
);
}
...
...
typesystem/src/main/java/org/apache/hadoop/metadata/storage/memory/TraitStore.java
0 → 100644
View file @
82209db0
/**
* 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
.
hadoop
.
metadata
.
storage
.
memory
;
import
org.apache.hadoop.metadata.storage.ReferenceableInstance
;
import
org.apache.hadoop.metadata.storage.RepositoryException
;
import
org.apache.hadoop.metadata.storage.StructInstance
;
import
org.apache.hadoop.metadata.types.TraitType
;
import
java.util.ArrayList
;
public
class
TraitStore
extends
HierarchicalTypeStore
{
final
ArrayList
<
String
>
classNameStore
;
public
TraitStore
(
MemRepository
repository
,
TraitType
hierarchicalType
)
throws
RepositoryException
{
super
(
repository
,
hierarchicalType
);
classNameStore
=
new
ArrayList
<
String
>();
}
void
store
(
ReferenceableInstance
i
)
throws
RepositoryException
{
int
pos
=
idPosMap
.
get
(
i
.
getId
());
StructInstance
s
=
(
StructInstance
)
i
.
getTrait
(
hierarchicalType
.
getName
());
super
.
storeFields
(
pos
,
s
);
classNameStore
.
set
(
pos
,
i
.
getTypeName
());
}
public
void
ensureCapacity
(
int
pos
)
throws
RepositoryException
{
super
.
ensureCapacity
(
pos
);
while
(
classNameStore
.
size
()
<
pos
+
1
)
{
classNameStore
.
add
(
null
);
}
}
}
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment