Skip to content
GitLab
Projects
Groups
Snippets
Help
Loading...
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
cloogle.org
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Service Desk
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Operations
Operations
Incidents
Environments
Analytics
Analytics
CI / CD
Repository
Value Stream
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Cloogle
cloogle.org
Commits
ca81bcff
Verified
Commit
ca81bcff
authored
Nov 30, 2018
by
Camil Staps
🚀
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Update submodule; overwrite rank settings CAF on start-up
parent
5be52411
Pipeline
#16836
passed with stage
in 15 minutes and 17 seconds
Changes
2
Pipelines
1
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
19 additions
and
17 deletions
+19
-17
backend/Cloogle
backend/Cloogle
+1
-1
backend/CloogleServer.icl
backend/CloogleServer.icl
+18
-16
No files found.
Cloogle
@
299aef08
Compare
7563b05f
...
299aef08
Subproject commit
7563b05f00f7403ef72ab9425dd5f1e3fba7657f
Subproject commit
299aef08632887d4b013969b97f9fb65e9aab8e2
backend/CloogleServer.icl
View file @
ca81bcff
...
...
@@ -187,13 +187,15 @@ Start w
#
rsets
=
fromJSON
$
fromString
$
fromOk
f
|
isError
f
||
isNothing
rsets
=
errexit
"Could not open rank settings
\n
"
-1
w
#!
rsets
=
fromJust
rsets
#!
(
ok
,
rsets
)
=
setRankSettings
rsets
|
not
ok
=
errexit
"Failed to set rank settings
\n
"
-1
w
|
isJust
opts
.
test_file
#
(
ok
,
f
,
w
)
=
fopen
(
fromJust
opts
.
test_file
)
FReadText
w
|
not
ok
=
errexit
"Could not open test file
\n
"
-1
w
=
test
opts
.
test_options
rsets
f
db
w
#!
(
db
,
w
)
=
if
opts
.
reload_cache
(
doInBackground
(
reloadCache
rsets
)
)
id
(
db
,
w
)
=
test
opts
.
test_options
f
db
w
#!
(
db
,
w
)
=
if
opts
.
reload_cache
(
doInBackground
reloadCache
)
id
(
db
,
w
)
=
serve
{
handler
=
handle
rsets
{
handler
=
handle
,
logger
=
Just
log
,
port
=
opts
.
Options
.
port
,
connect_timeout
=
Just
3600000
// 1h
...
...
@@ -212,9 +214,9 @@ errexit msg rcode w
#
(_,
w
)
=
fclose
(
stderr
<<<
msg
)
w
=
setReturnCode
rcode
w
handle
::
!
RankSettings
!
(
Maybe
Request
)
!*
CloogleDB
!*
World
->
*(!
Response
,
!(!
Maybe
CacheKey
,
!
MicroSeconds
),
!*
CloogleDB
,
!*
World
)
handle
_
Nothing
db
w
=
(
err
InvalidInput
"Couldn't parse input"
Nothing
,
(
Nothing
,
0
),
db
,
w
)
handle
rsets
(
Just
request
=:{
unify
,
name
,
page
})
db
w
handle
::
!(
Maybe
Request
)
!*
CloogleDB
!*
World
->
*(!
Response
,
!(!
Maybe
CacheKey
,
!
MicroSeconds
),
!*
CloogleDB
,
!*
World
)
handle
Nothing
db
w
=
(
err
InvalidInput
"Couldn't parse input"
Nothing
,
(
Nothing
,
0
),
db
,
w
)
handle
(
Just
request
=:{
unify
,
name
,
page
})
db
w
#!
(
start
,
w
)
=
nsTime
w
//Check cache
#!
(
key
,
db
)
=
toRequestCacheKey
db
request
...
...
@@ -232,7 +234,7 @@ handle rsets (Just request=:{unify,name,page}) db w
=
respond
start
Nothing
(
err
InvalidInput
"Empty query"
Nothing
)
db
w
// Results
#!
drop_n
=
fromJust
(
page
<|>
pure
0
)
*
MAX_RESULTS
#!
(
res
,
suggs
,
db
)
=
searchWithSuggestions
r
sets
r
equest
db
#!
(
res
,
suggs
,
db
)
=
searchWithSuggestions
request
db
#!
suggs
=
if
(
isEmpty
suggs
)
Nothing
(
Just
suggs
)
#!
results
=
drop
drop_n
res
#!
more
=
max
0
(
length
results
-
MAX_RESULTS
)
...
...
@@ -281,8 +283,8 @@ where
}
(
give
,
keep
)
=
splitAt
MAX_RESULTS
results
reloadCache
::
!
RankSettings
!
*(!*
CloogleDB
,
!*
World
)
->
*(!*
CloogleDB
,
!*
World
)
reloadCache
rsets
(
db
,
w
)
reloadCache
::
!*(!*
CloogleDB
,
!*
World
)
->
*(!*
CloogleDB
,
!*
World
)
reloadCache
(
db
,
w
)
#
(
ks
,
w
)
=
allCacheKeys
LongTerm
w
=
loop
ks
db
w
where
...
...
@@ -290,7 +292,7 @@ where
loop
[]
db
w
=
(
db
,
w
)
loop
[
k
:
ks
]
db
w
#
w
=
removeFromCache
LongTerm
k
w
#
(_,_,
db
,
w
)
=
handle
rsets
(
Just
$
fromRequestCacheKey
k
)
db
w
#
(_,_,
db
,
w
)
=
handle
(
Just
$
fromRequestCacheKey
k
)
db
w
#
db
=
resetDB
db
=
loop
ks
db
w
...
...
@@ -301,8 +303,8 @@ doInBackground f w
|
pid
>
0
=
w
// Parent: return directly
|
otherwise
=
snd
$
exit
0
$
f
w
// Child: do function
test
::
![
TestOption
]
!
RankSettings
!
*
File
!*
CloogleDB
!*
World
->
*
World
test
opts
rsets
queries
db
w
test
::
![
TestOption
]
!*
File
!*
CloogleDB
!*
World
->
*
World
test
opts
queries
db
w
#
(
e
,
queries
)
=
fend
queries
|
e
=
w
#
(
qstring
,
queries
)
=
freadline
queries
...
...
@@ -310,12 +312,12 @@ test opts rsets queries db w
#
q
=
parseSingleLineRequest
qstring
|
isError
q
#
w
=
snd
$
fclose
(
stderr
<<<
"Warning: could not parse '"
<<<
qstring
<<<
"'; "
<<<
fromError
q
<<<
"
\n
"
)
w
=
test
opts
rsets
queries
db
w
=
test
opts
queries
db
w
#
q
=
fromOk
q
|
excluded
opts
q
=
test
opts
rsets
queries
db
w
#
(_,_,
db
,
w
)
=
handle
rsets
(
Just
q
)
db
w
=
test
opts
rsets
queries
db
w
=
test
opts
queries
db
w
#
(_,_,
db
,
w
)
=
handle
(
Just
q
)
db
w
=
test
opts
queries
db
w
where
excluded
::
![
TestOption
]
!
Request
->
Bool
excluded
[]
_
=
False
...
...
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