| ÆÄÀÏ :: FDKeeper. FILE :: FDKEEKER´Â ³ªÁß¿¡ »ç¿ëÇÒ ¼öÀÖ´Â ´Ù¸¥ ÇÁ·Î¼¼½º¿¡¼ ¿¸° ÆÄÀÏ ÇÚµéÀ» ÀúÀåÇÒ ¼ö ÀÖ½À´Ï´Ù. |
Áö±Ý ´Ù¿î·Îµå |
ÆÄÀÏ :: FDKeeper. ¼øÀ§ ¹× ¿ä¾à
- ƯÇã:
- Perl Artistic License
- °Ô½ÃÀÚ À̸§:
- Patrick LeBoutillier
- °Ô½ÃÀÚ À¥»çÀÌÆ®:
- http://search.cpan.org/~patl/File-FDkeeper-0.06/FDkeeper.pod
ÆÄÀÏ :: FDKeeper. ű×
ÆÄÀÏ :: FDKeeper. ¼³¸í
FILE :: FDKEEKER´Â ³ªÁß¿¡ »ç¿ëÇÒ ¼ö ÀÖµµ·Ï ´Ù¸¥ ÇÁ·Î¼¼½º¿¡ ¿·ÁÀÖ´Â ÆÄÀÏ ÇÚµéÀ» ÀúÀåÇÒ ¼ö ÀÖ½À´Ï´Ù. ÆÄÀÏ :: FDKeeper´Â ³ªÁß¿¡ »ç¿ëÇϱâ À§ÇØ ´Ù¸¥ ÇÁ·Î¼¼½º¿¡ ¿·ÁÀÖ´Â ÆÄÀÏ ÇÚµéÀ» ÀúÀåÇÒ ¼ö ÀÖ½À´Ï´Ù. Synopsis # "Server"³» $ FDK = »õ ÆÄÀÏ :: FDKeeper (local => "/tmp/fdkeeper.sock"); $ FDK-> RUN (); # "Ŭ¶óÀ̾ðÆ®"MY $ FDK = »õ ÆÄÀÏ :: FDKEEKER (PEER => "/tmp/fdkeep.sock"); $ ID = $ FDK-> PUT ($ some_fh); $ fh = $ fdk-> get ($ ID); $ fdk-> del ($ id); file :: fdkeeper´Â "¼¹ö"ÇÁ·Î¼¼½º¿¡ ¿·ÁÀÖ´Â ÆÄÀÏ ÇÚµéÀ» ÀúÀåÇÏ°í ³ªÁß¿¡ ÆÄÀÏ ÇÚµéÀÌ ÀúÀåµÇ¸é ID°¡ ¹ÝȯµË´Ï´Ù. ÀÌ ID´Â ´Ù¸¥ ÇÁ·Î¼¼½º¿¡¼ ÆÄÀÏ ÇÚµéÀ» °Ë»öÇÏ´Â µ¥ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù (FIFO¸¦ ¿ ¼öÀÖ´Â ±ÇÇÑÀÌÀÖ´Â ÇÑ). ConstructOrSnew () ÆÄÀÏ :: FDKeeper °³Ã¼¸¦ ¸¸µì´Ï´Ù. »õ °ª ½ÖÀÇ ´ÙÀ½ Àμö ±×·ìÀ» ±â´ëÇÕ´Ï´Ù. Å° - °ª ½Ö : ·ÎÄà FIFOÀÇ ·ÎÄà °æ·Î´ÂÀÌ ÃÊ ¼ö°¡ ´ÝÈ÷±â ¶§¹®¿¡ ¾×¼¼½ºµÇÁö ¾Ê½À´Ï´Ù. ±âº»°ªÀº 0 (¹«ÇÑ´ë)ÀÔ´Ï´Ù. ExceTimeoutCheck ºóµµ (ÃÊ)¸¦ »ç¿ëÇÏ¿© ¸¸·á µÈ ÆÄÀÏ ÇÚµéÀ» È®ÀÎÇϽʽÿÀ. ±âº»°ªÀº 0ÀÔ´Ï´Ù (Àý´ë·Î). ÇǾî FIFOIF ·ÎÄÿ¡ ´ëÇÑ ÇÇ¾î °æ·Î°¡ ÁöÁ¤µÇ¸é "¼¹ö"°´Ã¼°¡ »ý¼ºµË´Ï´Ù. ÇǾ ÁöÁ¤µÇ¸é "Ŭ¶óÀ̾ðÆ®"°³Ã¼°¡ »ý¼ºµË´Ï´Ù .Methodsput (ÆÄÀÏ ÇÚµé)Àº ÆÄÀÏ ÇÚµéÀ» ÀúÀåÇÏ°í °ü·Ã ID¸¦ ¹ÝȯÇÕ´Ï´Ù. ¿À·ù°¡ ¹ß»ýÇÏ¸é ¿¹¿Ü°¡ throwµË´Ï´Ù. Âü°í : PutÀ» "Ŭ¶óÀ̾ðÆ®"°´Ã¼¿¡¼ È£ÃâµÇ¸é "¼¹ö"·Î º¸³»¸é ÆÄÀÏ ÇÚµéÀÌ ´ÝÈü´Ï´Ù. ÀÌ ÇÁ·Î¼¼½º¿¡¼ ³ªÁß¿¡ ÇØ´ç ÇÚµéÀ» °¡Á®¿Ã ¼ö ÀÖµµ·Ï Necesasry ÀÎ °ÍÀ¸·Î º¸Àδ٠(ID) FileHandle ID¸¦ °Ë»öÇÏ°íÀ̸¦ ¹ÝȯÇÕ´Ï´Ù. FileHandle ID°¡ Presentily ÀúÀåµÇÁö ¾ÊÀº °æ¿ì Undef¸¦ ¹ÝȯÇÕ´Ï´Ù. ¿À·ù°¡ ¹ß»ýÇÏ¸é ¿¹¿Ü°¡ ¹ß»ýÇß½À´Ï´Ù .Del (ID) ÆÄÀÏ ÇÚµé ID¸¦ Á¦°ÅÇÏ°í ´Ý½À´Ï´Ù. FileHandle ID°¡ ÇöÀç ÀúÀåµÇÁö ¾ÊÀº °æ¿ì Undef¸¦ ¹ÝȯÇÕ´Ï´Ù. ¿À·ù°¡ ¹ß»ýÇÏ¸é ¿¹¿Ü°¡ ¹ß»ýÇÕ´Ï´Ù .cnt () "¼¹ö"¿¡ÀÖ´Â ÆÄÀÏ ÇÚµé ¼ö¸¦ ¹ÝȯÇÕ´Ï´Ù. ¿À·ù°¡ ¹ß»ýÇÏ¸é ¿¹¿Ü°¡ throwµË´Ï´Ù .Run () Âü°í :ÀÌ ¸Þ¼Òµå´Â ÆÄÀÏ ÇÚµéÀ» ÀúÀåÇϱâ À§ÇØ FIFOÀÇ ¿¬°áÀ» ¼ö½Å ´ë±âÇÏ´Â "¼¹ö"°´Ã¼¿¡¼¸¸ »ç¿ëÇÒ ¼ö ÀÖ½À´Ï´Ù. ÀϹÝÀû À¸·ÎÀÌ ¹æ¹ýÀº ¹ÝȯµÇÁö ¾Ê½À´Ï´Ù. ±×·¯³ª ¶óÀÌÇÁ ¶óÀÎÀÌ À¯È¿ÇÑ ÆÄÀÏ ÇÚµé ÀÎ °æ¿ì ¶óÀÌÇÁ ¶óÀο¡¼ ¸ðµç µ¥ÀÌÅÍ (¶Ç´Â EOF)°¡ ¼ö½Å µÉ ¶§ ½ÇÇàµË´Ï´Ù. »ç¿ëÇÏ´Â °æ¿ì ¶óÀÌÇÁ ¶óÀÎÀº ÀϹÝÀûÀ¸·Î ´ÙÀ½°ú °°ÀÌ »ç¿ëµÇ´Â ÆÄÀÌÇÁÀÔ´Ï´Ù. IO :: ÆÄÀÌÇÁ; ³» $ PIPE = »õ·Î¿î IO :: ÆÄÀÌÇÁ (); if (fork ()) {$ pipe-> reader (); ÆÄÀÏ :: FDKeeper; ³» $ FDK = »õ ÆÄÀÏ :: FDKeeper (local => "/tmp/fdkeep.sock"); $ FDK-> ½ÇÇà ($ ÆÄÀÌÇÁ); Ãⱸ() ; } $ pipe-> writer (); # ÇÒ ÀÏ ... #ÀÌ ÇÁ·Î¼¼½º°¡ Á×À¸¸é ÆÄÀÏ :: fdkeeper ¼¹ö ÇÁ·Î¼¼½º°¡ # ´ÙÀ̾îÁ³½À´Ï´Ù. ¿ä±¸ »çÇ× : ¡¤ Perl.
ÆÄÀÏ :: FDKeeper. °ü·Ã ¼ÒÇÁÆ®¿þ¾î