public static Long parseLedgerId(String name) {
        if (name == null || name.isEmpty()) {
            return null;
        }
        if (name.endsWith("-index")) {
            name = name.substring(0, name.length() - "-index".length());
        }
        int pos = name.indexOf("-ledger-");
        if (pos < 0) {
            return null;
        }
        try {
            return Long.parseLong(name.substring(pos + 8));
        } catch (NumberFormatException err) {
            return null;
        }
    }
@Test
    public void parseLedgerIdTest() throws Exception {
       UUID id = UUID.randomUUID();
       long ledgerId = 123124;
        String key = DataBlockUtils.dataBlockOffloadKey(ledgerId, id);
        String keyIndex = DataBlockUtils.indexBlockOffloadKey(ledgerId, id);

        assertEquals(ledgerId, DataBlockUtils.parseLedgerId(key).longValue());
        assertEquals(ledgerId, DataBlockUtils.parseLedgerId(keyIndex).longValue());

        assertNull(DataBlockUtils.parseLedgerId(null));
        assertNull(DataBlockUtils.parseLedgerId(""));
        assertNull(DataBlockUtils.parseLedgerId("-ledger-"));
        assertNull(DataBlockUtils.parseLedgerId("something"));
        assertNull(DataBlockUtils.parseLedgerId("-ledger-index"));
    }