Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
E
eecs398-search
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
vcday
eecs398-search
Commits
c1a883ba
Commit
c1a883ba
authored
6 years ago
by
benbergk
Browse files
Options
Downloads
Patches
Plain Diff
began fixing local reader
parent
fdd33050
No related branches found
Branches containing commit
No related tags found
1 merge request
!2
WIP:Crawler parser 2 merge into duplicate url-crawler
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
crawler/Readers/LocalReader.cpp
+14
-16
14 additions, 16 deletions
crawler/Readers/LocalReader.cpp
crawler/Readers/LocalReader.h
+3
-2
3 additions, 2 deletions
crawler/Readers/LocalReader.h
with
17 additions
and
18 deletions
crawler/Readers/LocalReader.cpp
+
14
−
16
View file @
c1a883ba
...
...
@@ -7,35 +7,34 @@
bool
LocalReader
::
request
(
)
{
//FIXME
//open the file?
return
true
;
fd
=
util
::
getFileDescriptor
(
fileName
,
"R"
);
return
fd
!=
-
1
;
}
bool
LocalReader
::
fillBuffer
(
char
*
buf
,
size_t
buf_size
)
{
//FIXME
strcpy
(
buf
,
util
::
getFileMap
(
fileName
)
);
return
true
;
return
read
(
fd
,
buf
,
buf_size
)
==
buf_size
;
}
string
LocalReader
::
PageToString
(
)
{
//FIXME
string
s
(
"fix me"
);
return
s
;
string
temp
=
""
;
char
buf
[
10240
];
int
bytes
=
0
;
while
(
(
bytes
=
read
(
fd
,
buf
,
10240
)
)
>
0
)
{
temp
+=
string
(
buf
,
bytes
);
}
return
temp
;
}
ParsedUrl
LocalReader
::
getUrl
(
)
{
//FIXME
ParsedUrl
url
(
""
);
ParsedUrl
url
(
fileName
);
//Fixme
return
url
;
}
bool
LocalReader
::
checkStatus
(
)
{
return
true
;
...
...
@@ -43,6 +42,5 @@ bool LocalReader::checkStatus ( )
void
LocalReader
::
closeReader
(
)
{
//FIXME
//close the file?
close
(
fd
);
}
\ No newline at end of file
This diff is collapsed.
Click to expand it.
crawler/Readers/LocalReader.h
+
3
−
2
View file @
c1a883ba
...
...
@@ -17,16 +17,17 @@ public:
bool
fillBuffer
(
char
*
buf
,
size_t
buf_size
);
ParsedUrl
getUrl
(
);
bool
checkStatus
(
);
string
PageToString
(
);
ParsedUrl
getUrl
(
);
void
closeReader
(
);
private
:
string
fileName
;
int
fd
;
};
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