Skip to content

Commit

Permalink
the server package is now merged with the compiler
Browse files Browse the repository at this point in the history
  • Loading branch information
krangelov committed Oct 14, 2024
1 parent db58a4e commit 00fd704
Show file tree
Hide file tree
Showing 9 changed files with 12 additions and 602 deletions.
14 changes: 7 additions & 7 deletions src/compiler/api/GF/Server.hs
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ import System.Exit(ExitCode(..))
import GF.Infra.UseIO(readBinaryFile,writeBinaryFile,ePutStrLn)
import GF.Infra.SIO(captureSIO)
import GF.Data.Utilities(apSnd,mapSnd)
import qualified PGFService as PS
import Data.Version(showVersion)
import Paths_gf(getDataDir,version)
import GF.Infra.BuildInfo (buildInfo)
import GF.Server.PGFService
import GF.Server.SimpleEditor.Convert(parseModule)
import Control.Monad.IO.Class

Expand All @@ -53,9 +53,9 @@ server jobs port optroot init execute1 = do
state <- newMVar M.empty
datadir <- getDataDir
let root = maybe (datadir</>"www") id optroot
cache <- PS.newPGFCache root jobs
cache <- newPGFCache root jobs
setDir root
let readNGF = PS.readCachedNGF cache
let readNGF = readCachedNGF cache
state0 <- init readNGF
http_server (execute1 readNGF) state0 state cache root
where
Expand Down Expand Up @@ -110,15 +110,15 @@ handle logLn documentroot state0 cache execute stateVar conn = do
"/gfshell" -> addDate (stateful $ inDir command)
"/cloud" -> addDate (stateful $ inDir cloud)
"/parse" -> addDate (parse query)
"/version" -> addDate (versionInfo `fmap` PS.listPGFCache cache)
"/flush" -> addDate (PS.flushPGFCache cache >> return (ok200 "flushed"))
"/version" -> addDate (versionInfo `fmap` listPGFCache cache)
"/flush" -> addDate (flushPGFCache cache >> return (ok200 "flushed"))
'/':rpath ->
-- This code runs without mutual exclusion, so it must *not*
-- use/change the cwd. Access files by absolute paths only.
let path = translatePath rpath
in case (takeDirectory path,takeFileName path,takeExtension path) of
(_ ,_ ,".pgf") -> PS.pgfMain logLn conn cache path rq
(_ ,_ ,".ngf") -> PS.pgfMain logLn conn cache path rq
(_ ,_ ,".pgf") -> pgfMain logLn conn cache path rq
(_ ,_ ,".ngf") -> pgfMain logLn conn cache path rq
(dir,"grammars.cgi",_ ) -> addDate (grammarList dir query)
_ -> serveStaticFile conn rpath path
_ -> addDate (return $ resp400 upath)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
-- | A file cache to avoid reading and parsing the same file many times
module Cache (Cache,newCache,flushCache,expireCache,listCache,readCache,readCache') where
module GF.Server.Cache (Cache,newCache,flushCache,expireCache,listCache,readCache,readCache') where

import Control.Concurrent.MVar
import Data.Map (Map)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
{-# LANGUAGE CPP, ScopedTypeVariables #-}
module PGFService(pgfMain,
Caches,newPGFCache,readCachedPGF,readCachedNGF,
flushPGFCache,listPGFCache) where
module GF.Server.PGFService(pgfMain,
Caches,newPGFCache,readCachedPGF,readCachedNGF,
flushPGFCache,listPGFCache) where

import PGF2
import PGF2.Transactions
import Cache
import GF.Server.Cache

import Data.Time.Format(formatTime)
import Data.Time.Format(defaultTimeLocale,rfc822DateFormat)
Expand Down
340 changes: 0 additions & 340 deletions src/server/LICENSE

This file was deleted.

4 changes: 0 additions & 4 deletions src/server/Setup.hs

This file was deleted.

61 changes: 0 additions & 61 deletions src/server/URLEncoding.hs

This file was deleted.

99 changes: 0 additions & 99 deletions src/server/lighttpd.conf

This file was deleted.

15 changes: 0 additions & 15 deletions src/server/pgf-fcgi.hs

This file was deleted.

71 changes: 0 additions & 71 deletions src/server/pgf-service.cabal

This file was deleted.

0 comments on commit 00fd704

Please sign in to comment.