Changeset 59 for branches/home/psmith


Ignore:
Timestamp:
01/30/07 04:43:00 (18 years ago)
Author:
psmith
Message:

nio-logger first stab

Location:
branches/home/psmith/restructure
Files:
1 added
1 edited
3 moved

Legend:

Unmodified
Added
Removed
  • TabularUnified branches/home/psmith/restructure/TODO

    r45 r59  
    1212Create UDP server
    1313
    14 Create RPC server / client
    15 
    1614Non blocking connects
    17 
    18 Allow large packets
  • TabularUnified branches/home/psmith/restructure/src/nio-logger/run-logging-client.lisp

    r55 r59  
    1 (push :nio-debug *features*)
    2 (require :asdf)
    3 (require :nio-yarpc)
     1#|
     2Copyright (c) 2007
     3All rights reserved.
    44
    5 ;;shouldn't be listenting on the client hence nil for accept SM to start-server
    6 (sb-thread:make-thread #'(lambda()(nio:start-server 'identity 'identity nil :host "127.0.0.1" :port 9897)) :name "nio-server")
    7 (sleep 4)
    8 (let ((sm (nio:add-connection "127.0.0.1" 16323 'nio-yarpc:yarpc-client-state-machine)))
    9   (nio-utils:format-log t "toplevel adding conn ~A~%" sm)
    10   (loop
    11     (nio-utils:format-log t "Toplevel Submitting job~%" )
    12     (nio-utils:format-log t "Result of remote-execute ~A~%" (nio-yarpc:remote-execute sm "(nio-yarpc:test-rpc-list)"))))
     5Redistribution and use in source and binary forms, with or without
     6modification, are permitted provided that the following conditions
     7are met:
     81. Redistributions of source code must retain the above copyright
     9   notice, this list of conditions and the following disclaimer.
     102. Redistributions in binary form must reproduce the above copyright
     11   notice, this list of conditions and the following disclaimer in the
     12   documentation and/or other materials provided with the distribution.
     133. The name of the author may not be used to endorse or promote products
     14   derived from this software without specific prior written permission.
     15
     16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26|#
     27
     28(in-package :nio-logger)
     29
     30(declaim (optimize (debug 3) (speed 3) (space 0)))
     31
     32;;Tail the given log and write to remote logger
     33;;e.g. (tail-log "/var/log/httpd/access_log" "192.168.1.1")
     34(defun tail-log(filename ip-address)
     35  ;;shouldn't be listenting on the client hence nil for accept SM to start-server
     36  (sb-thread:make-thread #'(lambda()(nio:start-server 'identity 'identity nil :host "127.0.0.1" :port 9897)) :name "nio-server")
     37  (sleep 4)
     38  (let ((sm (nio:add-connection ip-address 16323 'nio-yarpc:yarpc-client-state-machine)))
     39    (nio-utils:format-log t "toplevel adding conn ~A to ~A~%" sm ip-address)
     40    (with-open-file (in filename :direction :input)
     41      (loop for text = (read-line in nil nil)
     42        (let ((rpc (format nil "(nio-logger:log +log-file-name+ ~A" text)))
     43          (nio-utils:format-log t "Toplevel Submitting job~A~%" rpc)
     44          (nio-utils:format-log t "Result of remote-log ~A~%" (nio-yarpc:remote-execute sm rpc)))))))
  • TabularUnified branches/home/psmith/restructure/src/nio-logger/run-logging-server.lisp

    r58 r59  
     1#|
     2Copyright (c) 2007
     3All rights reserved.
     4
     5Redistribution and use in source and binary forms, with or without
     6modification, are permitted provided that the following conditions
     7are met:
     81. Redistributions of source code must retain the above copyright
     9   notice, this list of conditions and the following disclaimer.
     102. Redistributions in binary form must reproduce the above copyright
     11   notice, this list of conditions and the following disclaimer in the
     12   documentation and/or other materials provided with the distribution.
     133. The name of the author may not be used to endorse or promote products
     14   derived from this software without specific prior written permission.
     15
     16THIS SOFTWARE IS PROVIDED BY THE AUTHOR ``AS IS'' AND ANY EXPRESS OR
     17IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES
     18OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED.
     19IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY DIRECT, INDIRECT,
     20INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT
     21NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
     22DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
     23THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
     24INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF
     25THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
     26|#
     27
     28(in-package :nio-logger)
     29
     30(declaim (optimize (debug 3) (speed 3) (space 0)))
     31
     32
    133;Runs a multithreaded system with an IO thread dealing with IO only and a 'job'  thread taking and executing jobs
    234
    3 (push :nio-debug *features*)
    4 (require :asdf)
    5 (require :nio-yarpc)
     35(defun run-logging-server()
     36  (setf nio-yarpc:+process-jobs-inline+ nil)
     37  (nio:load-ips "ips.txt")
     38  (sb-thread:make-thread #'(lambda()(nio:start-server 'identity 'identity 'nio-yarpc:yarpc-state-machine :host "127.0.0.1" :accept-connection 'nio:check-ip)) :name "nio-server")
     39  (loop
     40    ;;block waiting for jobs
     41     (nio-yarpc:run-job)))
    642
    7 (setf nio-yarpc:+process-jobs-inline+ nil)
    8 (nio:load-ips "ips.txt")
    9 (sb-thread:make-thread #'(lambda()(nio:start-server 'identity 'identity 'nio-yarpc:yarpc-state-machine :host "127.0.0.1" :accept-connection 'nio:check-ip)) :name "nio-server")
    10 (loop
    11     ;;block waiting for jobs
    12      (nio-yarpc:run-job))
     43(defremote log(destination control-string &rest format-arguments)
     44  (format-log destination control-string format-arguments))
Note: See TracChangeset for help on using the changeset viewer.