code: LogMetadata truncate(LedgerAddress upToAddress) {
          Preconditions.checkState(this.enabled, "Log is not enabled. Cannot perform any modifications on it.");
  
          // Exclude all those Ledgers that have a LedgerId less than the one we are given. An optimization to this would
          // involve trimming out the ledger which has a matching ledger id and the entry is is the last one, but that would
          // involve opening the Ledger in BookKeeper and inspecting it, which would take too long.
          val newLedgers = this.ledgers.stream().filter(lm -> lm.getLedgerId() >= upToAddress.getLedgerId()).collect(Collectors.toList());
          return new LogMetadata(this.epoch, this.enabled, Collections.unmodifiableList(newLedgers), upToAddress, this.updateVersion.get());
      }
docs: Creates a new instance of the LogMetadata class which contains all the ledgers after (and including) the given address.
  
  @param upToAddress The address to truncate to.
  @return A new instance of the LogMetadata class.