code: func New(directory string) blockledger.Factory {
  	logger.Debugf("Initializing ledger at: %s", directory)
  	if err := os.MkdirAll(directory, 0700); err != nil {
  		logger.Panicf("Could not create directory %s: %s", directory, err)
  	}
  
  	jlf := &jsonLedgerFactory{
  		directory: directory,
  		ledgers:   make(map[string]blockledger.ReadWriter),
  	}
  
  	infos, err := ioutil.ReadDir(jlf.directory)
  	if err != nil {
  		logger.Panicf("Error reading from directory %s while initializing ledger: %s", jlf.directory, err)
  	}
  
  	for _, info := range infos {
  		if !info.IsDir() {
  			continue
  		}
  		var chainID string
  		_, err := fmt.Sscanf(info.Name(), chainDirectoryFormatString, &chainID)
  		if err != nil {
  			continue
  		}
  		jlf.GetOrCreate(chainID)
  	}
  
  	return jlf
  }
docs: // New creates a new ledger factory