Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
S
Sleuthkit
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Iterations
Requirements
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Locked files
Build
Pipelines
Jobs
Pipeline schedules
Test cases
Artifacts
Deploy
Releases
Package registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Code review analytics
Issue analytics
Insights
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Terms and privacy
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
IRT
Sleuthkit
Commits
36ffbcdb
Commit
36ffbcdb
authored
5 years ago
by
apriestman
Browse files
Options
Downloads
Patches
Plain Diff
Caching is working.
parent
2bfdef21
Branches
Branches containing commit
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
bindings/java/src/org/sleuthkit/datamodel/JniDbHelper.java
+13
-4
13 additions, 4 deletions
bindings/java/src/org/sleuthkit/datamodel/JniDbHelper.java
with
13 additions
and
4 deletions
bindings/java/src/org/sleuthkit/datamodel/JniDbHelper.java
+
13
−
4
View file @
36ffbcdb
...
@@ -19,6 +19,8 @@
...
@@ -19,6 +19,8 @@
package
org.sleuthkit.datamodel
;
package
org.sleuthkit.datamodel
;
import
org.apache.commons.lang3.StringUtils
;
import
org.apache.commons.lang3.StringUtils
;
import
java.util.List
;
// TEMP
import
java.util.ArrayList
;
// TEMP
import
java.util.HashMap
;
import
java.util.HashMap
;
import
java.util.Map
;
import
java.util.Map
;
import
java.util.Objects
;
import
java.util.Objects
;
...
@@ -42,6 +44,7 @@ class JniDbHelper {
...
@@ -42,6 +44,7 @@ class JniDbHelper {
private
final
Map
<
Long
,
Long
>
fsIdToRootDir
=
new
HashMap
<>();
private
final
Map
<
Long
,
Long
>
fsIdToRootDir
=
new
HashMap
<>();
private
final
Map
<
Long
,
TskData
.
TSK_FS_TYPE_ENUM
>
fsIdToFsType
=
new
HashMap
<>();
private
final
Map
<
Long
,
TskData
.
TSK_FS_TYPE_ENUM
>
fsIdToFsType
=
new
HashMap
<>();
private
final
Map
<
ParentCacheKey
,
Long
>
parentDirCache
=
new
HashMap
<>();
private
final
Map
<
ParentCacheKey
,
Long
>
parentDirCache
=
new
HashMap
<>();
private
final
List
<
ParentCacheKey
>
tempDidNotFind
=
new
ArrayList
<>();
JniDbHelper
(
SleuthkitCase
caseDb
)
{
JniDbHelper
(
SleuthkitCase
caseDb
)
{
this
.
caseDb
=
caseDb
;
this
.
caseDb
=
caseDb
;
...
@@ -294,14 +297,17 @@ long addFile(long parentObjId,
...
@@ -294,14 +297,17 @@ long addFile(long parentObjId,
// Testing!
// Testing!
if
(
metaType
==
TskData
.
TSK_FS_META_TYPE_ENUM
.
TSK_FS_META_TYPE_DIR
.
getValue
()
if
((
metaType
==
TskData
.
TSK_FS_META_TYPE_ENUM
.
TSK_FS_META_TYPE_DIR
.
getValue
()
||
(
metaType
==
TskData
.
TSK_FS_META_TYPE_ENUM
.
TSK_FS_META_TYPE_VIRT_DIR
.
getValue
()))
&&
(
name
!=
null
)
&&
(
name
!=
null
)
&&
!
name
.
equals
(
"."
)
&&
!
name
.
equals
(
"."
)
&&
!
name
.
equals
(
".."
))
{
&&
!
name
.
equals
(
".."
))
{
String
dirName
=
escaped_path
+
name
;
String
dirName
=
escaped_path
+
name
;
ParentCacheKey
key
=
new
ParentCacheKey
(
fsObjId
,
metaAddr
,
seq
,
dirName
);
ParentCacheKey
key
=
new
ParentCacheKey
(
fsObjId
,
metaAddr
,
seq
,
dirName
);
parentDirCache
.
put
(
key
,
objId
);
parentDirCache
.
put
(
key
,
objId
);
//System.out.println("### Saving: " + objId + " : " + metaAddr + " " + seq + " " + dirName);
if
(
metaAddr
==
34064
||
dirName
.
contains
(
"$Orphan"
))
{
//System.out.println("### Saving: " + objId + " : " + metaAddr + " " + seq + " " + dirName);
}
}
}
// Let's see if the parent lookup matches - skip for root folder
// Let's see if the parent lookup matches - skip for root folder
...
@@ -320,7 +326,10 @@ long addFile(long parentObjId,
...
@@ -320,7 +326,10 @@ long addFile(long parentObjId,
System
.
out
.
println
(
"### Mismatch : cached: "
+
cachedId
+
", given: "
+
parentObjId
+
" : "
+
keyStr
);
System
.
out
.
println
(
"### Mismatch : cached: "
+
cachedId
+
", given: "
+
parentObjId
+
" : "
+
keyStr
);
}
}
}
else
{
}
else
{
System
.
out
.
println
(
"### Did not find "
+
parentObjId
+
" : "
+
keyStr
+
" - orig parent_path: <"
+
escaped_path
+
">"
);
if
(!
tempDidNotFind
.
contains
(
key
))
{
System
.
out
.
println
(
"### Did not find "
+
parentObjId
+
" : "
+
keyStr
+
" - orig parent_path: <"
+
escaped_path
+
">"
);
tempDidNotFind
.
add
(
key
);
}
}
}
}
}
...
@@ -413,7 +422,7 @@ long addLayoutFileRange(long objId, long byteStart, long byteLen, long seq) {
...
@@ -413,7 +422,7 @@ long addLayoutFileRange(long objId, long byteStart, long byteLen, long seq) {
*/
*/
long
findParentObjId
(
long
metaAddr
,
long
fsObjId
,
String
path
,
String
name
)
{
long
findParentObjId
(
long
metaAddr
,
long
fsObjId
,
String
path
,
String
name
)
{
try
{
try
{
System
.
out
.
println
(
"### Had to do lookup for meta addr: "
+
metaAddr
+
" and path: "
+
path
+
" "
+
name
);
//
System.out.println("### Had to do lookup for meta addr: " + metaAddr + " and path: " + path + " " + name);
return
caseDb
.
findParentObjIdJNI
(
metaAddr
,
fsObjId
,
path
,
name
,
trans
);
return
caseDb
.
findParentObjIdJNI
(
metaAddr
,
fsObjId
,
path
,
name
,
trans
);
}
catch
(
TskCoreException
ex
)
{
}
catch
(
TskCoreException
ex
)
{
logger
.
log
(
Level
.
WARNING
,
"Error looking up parent with meta addr: "
+
metaAddr
+
" and name "
+
name
,
ex
);
logger
.
log
(
Level
.
WARNING
,
"Error looking up parent with meta addr: "
+
metaAddr
+
" and name "
+
name
,
ex
);
...
...
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment