Note: This website is archived. For up-to-date information about D projects and development, please visit wiki.dlang.org.
Version 3 (modified by kris, 17 years ago)
updated links

This page represents Mango prior to the Tango integration

Welcome to the Mango Tree

Download information is over here

Discussion forums are here

Please visit our GuestBook

Introduction

Mango is a collection of D packages with an orientation toward server-side programming. These packages may be used together or in isolation and, in many cases, can be just as applicable to client-side development. Mango is targeted for Win32 and linux platforms.

There are currently eleven packages under the Mango Tree:

  • mango.io: a high-performance buffered IO package. Primary functionality includes memory Buffers, external Conduits (files, sockets, etc), file-system manipulation, several flavors of Readers and Writers (formatted data), TextLayout support, class serialization, tokenization, and a whole lot more. Socket support is via the gracious provision of Christopher Miller's socket module. See File, UnicodeFile, FilePath, FileProxy, FileConduit, FileSystem, FileConst, SocketConduit, ServerSocket, MulticastSocket, SocketListener, Token, Print, Stdin, Stdout, Buffer, Reader, Writer, IPickle and PickleRegistry. Mango.io is configurable for stream-filtering, and for a variety of text-encodings (via BufferCodec, or the ICU wrappers).
  • mango.http.client: An HTTP client for conversing with a remote HTTP server. Supports headers, query parameters, cookies, timeout etc. Tokenizer classes in mango.io are handy for parsing returned content. See HttpClient.
  • mango.http.server: an HTTP server framework is provided for implementing a variety of high performance servers based on the HTTP protocol. This is not a fully-fledged v1.1 implementation. That is, it doesn't currently support 'fields' or 'keep alive'. However, it happily processes each request without allocating memory, making it unusually efficient. This is an example of how D array-slicing can seriously improve runtime efficiency. An open-source HTTPS library should be fairly easy to bolt in. Modules HttpServer and IProvider are the primary entry points: you implement an instance of the latter, and hand it to the former.
  • mango.servlet: A servlet-style engine that sits upon mango.server. Includes most of the things that Java servlet programmers would expect, and attempts to improve in certain key areas such as the IO system. See Servlet and ServletProvider, and the Servlets example.
  • mango.cache: Some simple caching mechanisms. Includes MRU caching via a queue, and level-two caching (to disk) via class-serialization. Now based upon a derivative of Doug Lea's concurrent hashmap. The mango.cluster package derives from mango.cache, so it's really easy to switch between a local cache implementation and a clustered version. See ICache, IMutableCache, PlainCache, QueuedCache and VirtualCache.
  • mango.log: An implementation of the popular Log4J package, for logging and tracing of runtime behaviour. See this page for an introduction to Log4J. Mango.log exposes an extensible and customizable framework, has been optimised heavily for minimal runtime overhead, does not impact the GC once initialised, and operates with either Mango.io or Phobos streams. Mango.log can generate remote log messages for use with Chainsaw, and has a browser-based 'Administrator' which allows remote, dynamic inspection and adjustment of the log settings within an executing program. See Logger, BasicConfigurator and PropertyConfigurator. There are a number of examples that show how to use these facilities ~ see Logging
  • mango.cluster: A clustering package for servers and other network aware applications. Currently supports clustered caching and queuing, where the former is limited to a fixed MRU number of entries per node, and the latter is limited to an upper memory waterline. While the underlying QOS (quality of service) substrate is setup to be plugable, the QOS currently provided is stream/multicast based. Note that this package is not a substitute for a persistence layer; instead it is a tool for enabling horizontal scaling within a system that has been designed explicitly from the outset to scale. On the other hand, it can significantly enhance the throughput of any persistence layer by offloading a large percentage of read operations. See CacheInvalidatee, CacheInvalidator, NetworkCombo, NetworkAlert, NetworkCache and NetworkQueue.
  • mango.icu: Set of wrappers around the ICU I18N project. See this page for the scoop on what is probably the most comprehensive and functional project in this particular arena. Mango.icu exposes the C API in a manner that takes advantage of D arrays and so on. See UCalendar, UChar, UConverter, UDateFormat, ULocale, UMessageFormat, UNumberFormat, UResourceBundle, UString, UText, UCollator, USet, UTransform, USearch, UNormalize, UDomainName, UBreakIterator, URegex, and UTimeZone. Numeric formatting is handled by a range of subclasses,including UDecimalFormat, UCurrencyFormat, UPercentFormat, UScientificFormat, and USpelloutFormat. There's a set of adapter classes in UMango which can be used to bind the ICU converters to Mango.io, thereby enabling Reader/Writer streaming with the full suite of ICU transcoders.
  • mango.convert: includes a range of formatting modules, including Sprint, Format, Integer, Double, and Atoi. The precision floating-point converters from David Gay are wrapped as DGDouble, and can be configured instead of Double. There's also a date parser and formatter, Rfc1123. Finally, there's a complement of high-performance Unicode converters, along with a module for handling unicode BOM. Mango.convert is templated for char, wchar, and dchar. The printf() compatable Sprint and Print convert char, wchar, and dchar arguments appropriately for the target representation.
  • mango.sys: includes a number of low-level utilities such as ByteSwap, and various O/S-specific functions. Also includes a great time-conversion module, Epoch, which hides the complexity of the relevant O/S functions ~ see LocalTime.
  • mango.text: Unicode token-parsing and string handling. Includes String, ImmutableString, SimpleIterator, QuoteIterator, RegexIterator and LineIterator. Iterators support streaming via internal use of IBuffer, which also enables lockstep reading across multiple iterator (and reader) instances when bound to a common source. See Lineio for a LineIterator example, and Token for a QuoteIterator example.

Additional packages under construction:

  • mango.containers: includes a hierarchical based containers (collections, as they are known in Java) library. This library is still a work in progress.
  • mango.xml.dom: provides a DOM implementation as well as a parser to go along with it.
  • mango.xml.rpc: uses the dom package to provide an XML-RPC interface

Targets, dependencies, and packaging

Mango packages target both Ares and Phobos. To compile for Ares, make sure to use -version=Ares when compiling, and point the -I option at the Ares packages. Build.exe will need a -X option also (for Ares).

Package dependencies are as follows (from left to right):

  • mango.sys => [none]
  • mango.convert => [none]
  • mango.io => mango.convert, mango.sys
  • mango.log => mango.io (without -version=Isolated)
  • mango.icu => mango.io (without -version=Isolated)
  • mango.cache => mango.io
  • mango.http.server => mango.io
  • mango.http.client => mango.io, mango.server
  • mango.cluster => mango.io, mango.cache, mango.log
  • mango.servlet => mango.io, mango.http.server, mango.cache, mango.log
  • mango.containers => [none]
  • mango.xml.dom => mango.icu, mango.containers, mango.io
  • mango.xml.rpc => mango.xml.dom
  • mango.text => mango.convert

Mango.icu and Mango.log are also made available as independent packages, outside of the regular Mango Tree. To enable this, specify the flag -version=Isolated when building those packages

Links, examples, etc

You might take a look at the examples to get a general feel for functionality, and browse the pdf files. Those will probably be sufficient to get an idea where the Mango Tree might come in handy within your projects.

Discussion forums are hosted here, and the general introduction startshere. Please also check the release notes for a high-level view of the latest changes.